Import TemplateIO from _py_htmltext or _c_htmltext ... (quixote/ptl_compile.py)
Neil Schemenauer <nascheme-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Wed, 08 Jan 2003 19:13:29 -0500
| Newsgroups | gmane.comp.web.quixote.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /home/cvs/quixote
In directory hewson:/tmp/cvs-serv20544
Modified Files:
ptl_compile.py
Log Message:
Import TemplateIO from _py_htmltext or _c_htmltext. Simplify calls to
TemplateIO object. Update PTLC magic.
Index: ptl_compile.py
===================================================================
RCS file: /home/cvs/quixote/ptl_compile.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- ptl_compile.py 6 Jan 2003 21:49:33 -0000 1.28
+++ ptl_compile.py 9 Jan 2003 00:13:27 -0000 1.29
@@ -34,7 +34,7 @@
# magic names inserted into the code
-IO_MODULE = "quixote.TemplateIO"
+IO_MODULE = "quixote.html"
IO_CLASS = "TemplateIO"
IO_INSTANCE = "_q_output"
HTML_TEMPLATE_PREFIX = "_q_html_template_"
@@ -114,14 +114,14 @@
# create an instance, assign to IO_INSTANCE
klass = ast.Name(IO_CLASS)
- instance = ast.CallFunc(klass, [])
+ args = [ast.Const(template_type == "html")]
+ instance = ast.CallFunc(klass, args)
assign_name = ast.AssName(IO_INSTANCE, OP_ASSIGN)
assign = ast.Assign([assign_name], instance)
# return the IO_INSTANCE.getvalue(...)
func = ast.Getattr(ast.Name(IO_INSTANCE), "getvalue")
- args = [ast.Const(template_type)]
- ret = ast.Return(ast.CallFunc(func, args))
+ ret = ast.Return(ast.CallFunc(func, []))
# wrap original function code
code = ast.Stmt([assign, code, ret])
@@ -233,9 +233,9 @@
PTL_EXT = ".ptl"
PTLC_EXT = ".ptlc"
if sys.hexversion >= 0x20300a1:
- PTLC_MAGIC = "PTLC\x01\x00"
+ PTLC_MAGIC = "PTLC\x01\x01"
elif sys.hexversion >= 0x20200b1:
- PTLC_MAGIC = "PTLC\x00\x09"
+ PTLC_MAGIC = "PTLC\x00\x10"
elif sys.hexversion >= 0x20100b1:
PTLC_MAGIC = "PTLC\x00\x08"
elif sys.hexversion >= 0x20000b1: