[Zope] dynamically generated TAL not being interpreted
Tue, 4 Mar 2003 23:18:34 -0500
* Dieter Maurer <firstname.lastname@example.org> [2003-03-03 20:56:46 +0100]:
> N. Thomas wrote at 2003-3-1 23:46 -0500:
> > We have a script that generates TAL. The problem is that the content
> > is not being interpeted as TAL by Zope, but rather as raw HTML.
> You must make a Page Template object from your TAL source code, wrap
> it in an appropriate context (--> "__of__") and return it (or call it
> to let it render).
> You can do this only in an External Method (or other filesystem based
Well, this was a start in the right direction. But after wading through
the archives, the nearest solution I can cruft together is an external
method like this:
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
zptstr = \
If properlu rendered,
this sentence <b tal:omit-tag="">should contain no tags.</b>
zptid = 'foobar'
z = ZopePageTemplate(id=zptid, text=zptstr, content_type="text/html")
But this returns an error, probably because I'm stabbing in the dark.
Also, I have no idea where exactly to stick the "__of__" method. (I did
look at the relevant sections in
Where is the API for Products.PageTemplates.ZopePageTemplate
In Products.PageTemplates, should I use PageTemplate, or
PageTemplateFile, or ZopePageTemplate?
In the code above, I see that ZopePageTemplate requires that an id
be passed in, does that mean that I have to create a temporary ZPT
object in the Zope filesystem, return that, and somehow make sure it
is destroyed afterwards? I only passed in 'foobar' because it was
Also, if anyone could point me to a fragment of code that does something
similar it would be much appreciated.
Etiamsi occiderit me, in ipso sperabo