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

Jens Vagelpohl jens at dataflake.org
Thu May 14 08:17:46 EDT 2009


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

Changed:
  U   Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt
  U   Products.CMFCore/trunk/Products/CMFCore/FSPageTemplate.py

-=-
Modified: Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt	2009-05-14 12:11:16 UTC (rev 99947)
+++ Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt	2009-05-14 12:17:46 UTC (rev 99948)
@@ -4,6 +4,9 @@
 2.2.0 (unreleased)
 ------------------
 
+- FSPageTemplate: Prevent reading the underlying file without doing 
+  anything with the data in some cases.
+
 - FSObject: Ensure that ZCache invalidations only happens if the 
   filesystem modification time differs from the internally stored
   previous modification time.

Modified: Products.CMFCore/trunk/Products/CMFCore/FSPageTemplate.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/FSPageTemplate.py	2009-05-14 12:11:16 UTC (rev 99947)
+++ Products.CMFCore/trunk/Products/CMFCore/FSPageTemplate.py	2009-05-14 12:17:46 UTC (rev 99948)
@@ -82,13 +82,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