[Zope3-checkins] CVS: Zope3/src/zope/app/pythonpage - __init__.py:1.5

Tim Peters tim.one at comcast.net
Mon Mar 8 18:55:00 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/pythonpage
In directory cvs.zope.org:/tmp/cvs-serv8578/src/zope/app/pythonpage

Modified Files:
	__init__.py 
Log Message:
PythonPage:  added XXX comment about a test that fails on Windows.


=== Zope3/src/zope/app/pythonpage/__init__.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/pythonpage/__init__.py:1.4	Tue Mar  2 10:50:04 2004
+++ Zope3/src/zope/app/pythonpage/__init__.py	Mon Mar  8 18:54:59 2004
@@ -25,9 +25,9 @@
 from zope.schema import SourceText, TextLine
 from zope.app.i18n import ZopeMessageIDFactory as _
 
-triple_quotes_start = re.compile('^[ \t]*("""|\'\'\')', re.MULTILINE) 
-single_triple_quotes_end = re.compile("'''") 
-double_triple_quotes_end = re.compile('"""') 
+triple_quotes_start = re.compile('^[ \t]*("""|\'\'\')', re.MULTILINE)
+single_triple_quotes_end = re.compile("'''")
+double_triple_quotes_end = re.compile('"""')
 
 class IPythonPage(Interface):
     """Python Page
@@ -101,6 +101,11 @@
       ... except SyntaxError, err:
       ...     print err
       invalid syntax (pp, line 1)
+
+      XXX That last one fails on Windows.  The actual error msg there is
+      XXX    invalid syntax (/pp, line 1)
+      XXX The leading slash evidently comes from self.__filename(), but
+      XXX no idea which (there are many) "getPath()" function that's calling.
     """
 
     implements(IPythonPage)
@@ -117,14 +122,14 @@
         else:
             filename = zapi.getPath(self)
         return filename
-        
+
     def setSource(self, source):
         r"""Set the source of the page and compile it.
 
         This method can raise a syntax error, if the source is not valid.
         """
         self.__source = source
-        
+
         source = source.encode('utf-8')
         start = 0
         match = triple_quotes_start.search(source, start)
@@ -133,7 +138,7 @@
             source = source[:match.end()-3] + 'print u' + \
                      source[match.end()-3:]
             start = match.end() + 7
-            
+
             # Now let's find the end of the quote
             if match.group().endswith('"""'):
                 end = double_triple_quotes_end.search(source, start)
@@ -147,8 +152,8 @@
                     'No matching closing quotes found.',
                     (self.__filename(), lineno, offset, match.group()))
 
-            start = end.end()    
-            match = triple_quotes_start.search(source, start)        
+            start = end.end()
+            match = triple_quotes_start.search(source, start)
 
         self.__prepared_source = source
 
@@ -159,7 +164,7 @@
     def getSource(self):
         """Get the original source code."""
         return self.__source
-        
+
     # See IPage
     source = property(getSource, setSource)
 




More information about the Zope3-Checkins mailing list