I really wanted to use with statements in the .ptl files. Since
"from __future__ import with_statement" didn't work, I did this:

--- ptl_compile.py.orig 2006-08-08 00:53:53.000000000 +0300
+++ ptl_compile.py      2007-09-19 12:47:22.000000000 +0300
@@ -63,6 +63,18 @@
 
         for node in nodelist:
             if node[0] != token.ENDMARKER and node[0] != token.NEWLINE:
+                try:
+                    if node[0] == symbol.stmt and \
+                           node[1][0] == symbol.simple_stmt and \
+                           node[1][1][0] == symbol.small_stmt and \
+                           node[1][1][1][0] == symbol.import_stmt and \
+                           node[1][1][1][1][0] == symbol.import_from and \
+                           node[1][1][1][1][2][0] == symbol.dotted_name and \
+                           node[1][1][1][1][2][1][0] == token.NAME and \
+                           node[1][1][1][1][2][1][1] == '__future__':
+                        continue
+                except:
+                    pass
                 self.com_append_stmt(stmts, node)
 
         return ast.Module(doc, ast.Stmt(stmts))

-- 
Patrik
_______________________________________________
Quixote-users mailing list
[email protected]
http://mail.mems-exchange.org/mailman/listinfo/quixote-users

Reply via email to