[Zope3-checkins] SVN: Zope3/trunk/src/zope/pagetemplate/pagetemplate.py Do not accumulate newlines between the error marker and the template content.

Fred L. Drake, Jr. fred at zope.com
Wed Jul 7 14:54:17 EDT 2004


Log message for revision 26180:
Do not accumulate newlines between the error marker and the template content.


-=-
Modified: Zope3/trunk/src/zope/pagetemplate/pagetemplate.py
===================================================================
--- Zope3/trunk/src/zope/pagetemplate/pagetemplate.py	2004-07-07 18:49:53 UTC (rev 26179)
+++ Zope3/trunk/src/zope/pagetemplate/pagetemplate.py	2004-07-07 18:54:17 UTC (rev 26180)
@@ -145,12 +145,16 @@
         if text.startswith(_error_start):
             errend = text.find('-->')
             if errend >= 0:
-                text = text[errend + 4:]
+                text = text[errend + 3:]
+                if text[:1] == "\r":
+                    text = text[1:]
+                if text[:1] == "\n":
+                    text = text[1:]
         if self._text != text:
             self._text = text
 
-        # we always want to cook on an update, even if the source
-        # is the same.  Possibly because the content-type might have changed.
+        # Always cook on an update, even if the source is the same;
+        # the content-type might have changed.
         self._cook()
 
     def read(self):



More information about the Zope3-Checkins mailing list