[Checkins] SVN: Products.CMFCore/branches/2.1/Products/CMFCore/ - FSPageTemplate: Prevent reading the underlying file without doing

Jens Vagelpohl jens at dataflake.org
Thu May 14 08:23:30 EDT 2009


Log message for revision 99949:
  - FSPageTemplate: Prevent reading the underlying file without doing
    anything with the data in some cases.
  

Changed:
  U   Products.CMFCore/branches/2.1/Products/CMFCore/CHANGES.txt
  U   Products.CMFCore/branches/2.1/Products/CMFCore/FSPageTemplate.py

-=-
Modified: Products.CMFCore/branches/2.1/Products/CMFCore/CHANGES.txt
===================================================================
--- Products.CMFCore/branches/2.1/Products/CMFCore/CHANGES.txt	2009-05-14 12:17:46 UTC (rev 99948)
+++ Products.CMFCore/branches/2.1/Products/CMFCore/CHANGES.txt	2009-05-14 12:23:30 UTC (rev 99949)
@@ -4,6 +4,9 @@
 2.1.3-beta (unreleased)
 -----------------------
 
+- FSPageTemplate: Prevent reading the underlying file without doing
+  anything with the data in some cases.
+
 - tool interfaces: Replace non-existing IMember interface with the
   correct IMemberData.
 

Modified: Products.CMFCore/branches/2.1/Products/CMFCore/FSPageTemplate.py
===================================================================
--- Products.CMFCore/branches/2.1/Products/CMFCore/FSPageTemplate.py	2009-05-14 12:17:46 UTC (rev 99948)
+++ Products.CMFCore/branches/2.1/Products/CMFCore/FSPageTemplate.py	2009-05-14 12:23:30 UTC (rev 99949)
@@ -80,13 +80,13 @@
     def _readFile(self, reparse):
         """Read the data from the filesystem.
         """
-        file = open(self._filepath, 'rU') # not 'rb', as this is a text file!
-        try:
-            data = file.read()
-        finally:
-            file.close()
+        if reparse:
+            file = open(self._filepath, 'rU') # not 'rb', as this is a text file!
+            try:
+                data = file.read()
+            finally:
+                file.close()
 
-        if reparse:
             # If we already have a content_type set it must come from a
             # .metadata file and we should always honor that. The content
             # type is initialized as text/html by default, so we only



More information about the Checkins mailing list