--------------------------------------------
from TAL.TALInterpreter import TALInterpreter
from Products.PageTemplates.Expressions import getEngine
from Products.PageTemplates.PageTemplate import PageTemplate
from cStringIO import StringIO
data = {
'test': 'Testing text',
}
t1='<h1 tal:content="test"></h1>'
context = getEngine().getContext(data)
buffer = StringIO()
pt = PageTemplate()
pt.write(t1)
pt._cook()
TALInterpreter(pt._v_program, pt._v_macros, context, buffer)()
macro = buffer.getvalue()
print macro
And z3 version... ;)
------------------
from zope.tal.talinterpreter import TALInterpreter
from zope.tales.tales import ExpressionEngine, Context
from zope.pagetemplate.pagetemplate import PageTemplate
from cStringIO import StringIO
data = {
'test': 'Testing text',
}
t1='<h1 tal:content="test"></h1>'
context = Context(ExpressionEngine(),data)
buffer = StringIO()
pt = PageTemplate()
pt.write(t1)
pt._cook()
TALInterpreter(pt._v_program, pt._v_macros, context, buffer)()
macro = buffer.getvalue()
print macro
-----------------
Pawel
_______________________________________________
Zope3-users mailing list
[email protected]
http://mail.zope.org/mailman/listinfo/zope3-users