SVN: r25662 - trunk/quixote

David Binger <dbinger-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Mon, 22 Nov 2004 14:43:29 -0500
Newsgroups gmane.comp.web.quixote.cvs
Message-ID <[email protected]>
Author: dbinger
Date: 2004-11-22 14:05:23 -0500 (Mon, 22 Nov 2004)
New Revision: 25662

Modified:
   trunk/quixote/ptl_compile.py
Log:
Update some comments.  Fix compile_dir() to look for pyc files.


Modified: trunk/quixote/ptl_compile.py
===================================================================
--- trunk/quixote/ptl_compile.py	2004-11-22 18:52:35 UTC (rev 25661)
+++ trunk/quixote/ptl_compile.py	2004-11-22 19:05:23 UTC (rev 25662)
@@ -246,8 +246,9 @@
 def compile_template(input, filename, output=None):
     """(input, filename, output=None) -> code
 
-    Compile an open file.  If output is not None then the code is written
-    with the magic template header.  The code object is returned.
+    Compile an open file.
+    If output is not None then the code is written to output.
+    The code object is returned.
     """
     buf = input.read()
     template = Template(buf, filename)
@@ -259,14 +260,14 @@
 def compile(inputname, outputname):
     """(inputname, outputname)
 
-    Compile a template file.  The new template is writen to outputname.
+    Compile a template file.  The new template is written to outputname.
     """
     input = open(inputname)
     output = open(outputname, "wb")
     try:
         compile_template(input, inputname, output)
     except:
-        # don't leave a corrupt .ptlc file around
+        # don't leave a corrupt .pyc file around
         output.close()
         os.unlink(outputname)
         raise
@@ -293,8 +294,8 @@
         fullname = os.path.join(dir, name)
         if os.path.isfile(fullname):
             head, tail = name[:-4], name[-4:]
-            if tail == '.ptl':
-                cfile = fullname + 'c'
+            if tail == PTL_EXT:
+                cfile = fullname[:-4] + '.pyc'
                 ftime = os.stat(fullname)[stat.ST_MTIME]
                 try:
                     ctime = os.stat(cfile)[stat.ST_MTIME]