Quixote 1.2 on python 2.5

Jonathan Corbet <[email protected]> Thu, 31 Jul 2008 14:00:28 -0600
Newsgroups gmane.comp.web.quixote.user
Organization LWN.net
Message-ID <[email protected]>
We may well be the only people still running Quixote 1 out there...but
every time I look at converting the LWN code over to 2.x, I feel a
strong need to go somewhere dark and drink heavily.  Someday I suppose
we'll have to do it, but I'm in no hurry.

Just in case there's anybody else in the same boat, here's a little
patch which makes 1.2 work with Python 2.5...

jon

---
--- ptl_compile.py~	2004-09-30 11:36:19.000000000 -0600
+++ ptl_compile.py	2008-07-31 12:58:51.000000000 -0600
@@ -55,8 +55,12 @@ class TemplateTransformer(transformer.Tr
         # beginning of the module.
         doc = None # self.get_docstring(nodelist, symbol.file_input)
 
-        io_imp = ast.From(IO_MODULE, [(IO_CLASS, None)])
-        markup_imp = ast.From(MARKUP_MODULE, [(MARKUP_CLASS, None)])
+        if sys.hexversion >= 0x02050000:
+            io_imp = ast.From(IO_MODULE, [(IO_CLASS, None)], 0)
+            markup_imp = ast.From(MARKUP_MODULE, [(MARKUP_CLASS, None)], 0)
+        else:
+            io_imp = ast.From(IO_MODULE, [(IO_CLASS, None)])
+            markup_imp = ast.From(MARKUP_MODULE, [(MARKUP_CLASS, None)])
         markup_assign = ast.Assign([ast.AssName(MARKUP_MANGLED_CLASS,
                                                 OP_ASSIGN)],
                                    ast.Name(MARKUP_CLASS))