[CMF-checkins] CVS: CMF/CMFCore - FSDTMLMethod.py:1.9.36.2

Shane Hathaway shane@cvs.zope.org
Fri, 16 Aug 2002 09:47:06 -0400


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv10802

Modified Files:
      Tag: CMF-1_3-branch
	FSDTMLMethod.py 
Log Message:
Merged continued fix for collector #37


=== CMF/CMFCore/FSDTMLMethod.py 1.9.36.1 => 1.9.36.2 ===
--- CMF/CMFCore/FSDTMLMethod.py:1.9.36.1	Thu Aug  1 15:07:55 2002
+++ CMF/CMFCore/FSDTMLMethod.py	Fri Aug 16 09:47:05 2002
@@ -54,6 +54,8 @@
     security.declareProtected(ViewManagementScreens, 'manage_main')
     manage_main = Globals.DTMLFile('custdtml', _dtmldir)
 
+    _reading = 0
+
     def __init__(self, id, filepath, fullname=None, properties=None):
         FSObject.__init__(self, id, filepath, fullname, properties)
         # Normally called via HTML.__init__ but we don't need the rest that
@@ -69,15 +71,21 @@
         file = open(fp, 'rb')
         try:
             data = file.read()
-        finally: file.close()
+        finally:
+            file.close()
         self.raw = data
         if reparse:
-            self.cook()
+            self._reading = 1  # Avoid infinite recursion
+            try:
+                self.cook()
+            finally:
+                self._reading = 0
 
     # Hook up chances to reload in debug mode
     security.declarePrivate('read_raw')
     def read_raw(self):
-        self._updateFromFS()
+        if not self._reading:
+            self._updateFromFS()
         return Globals.HTML.read_raw(self)
 
     #### The following is mainly taken from OFS/DTMLMethod.py ###