[Zope] Call PageTemplateFile class instances
Andrew Milton
akm at theinternet.com.au
Thu Nov 13 12:19:36 EST 2008
+-------[ Peter Bengtsson ]----------------------
| I've kind of work it out. The trick is to write some boiler plate in
| the class definition like this::
|
| from zope import traversing, component, interface
| from zope.interface import implements
| from zope.traversing.interfaces import ITraversable
|
| from Products.PageTemplates.PageTemplateFile import PageTemplateFile
| class MyProduct(Folder):
|
| implements(ITraversable)
| component.provideAdapter(
| traversing.adapters.DefaultTraversable,
| (interface.Interface,),ITraversable)
|
| meta_type = "bla"
| page = PageTemplateFile('zpt/foo.pt', globals())
|
| def render_page(self):
| html = self.page(self.REQUEST) # ERROR!!
why do you do this double shuffle anyway, when you can directly call
"page" and protect it if necessary...
I certainly don't have the issue you're describing and I don't need to
do all that implements garbage either.
Are you sure you don't have some Product installed that's messing with
it?
--
Andrew Milton
akm at theinternet.com.au
More information about the Zope
mailing list