[Zope] Re: Filling a metal slot which name is known only at run time
Evan Simpson
evan at tokenexchange.com
Tue Dec 14 14:35:31 EST 2004
Martin Aspeli wrote:
> Interesting... How can I do that (compile + execute as a template)?
If you're writing a filesystem Product, it should be a simple as:
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
[...]
def run_template(self, *args, **kwargs):
zpt = getattr(self, '_v_zpt', None)
if zpt is None:
t = self.generate_template_text()
self._v_zpt = zpt = ZopePageTemplate('', t)
zpt.__of__(self)(*args, **kwargs)
This is totally untested, though. You may wish to look at
FSPageTemplate.py from CMF's CMFCore package.
Cheers,
Evan @ 4-am
More information about the Zope
mailing list