[Zope] Passing args to PageTemplateFile instances

Peter Bengtsson peter at fry-it.com
Fri Sep 23 05:19:57 EDT 2005


>     manage_main = PageTemplateFile("templates/mainTestProd", globals())
>     index_html = PageTemplateFile("templates/indexTestProd", globals())
>     test = PageTemplateFile("templates/test", globals())
>
>     def __init__(self, id, title):
>         self.id = id
>         self.title = title
>
>     def testit(self, REQUEST=None):
>         return self.test.__of__(self)(something="blah")
>
>
> In the template I should now be able to access options/something
> according to previous posts, but this:
>
> <span tal:replace="options/something"/>
>

Why the extra self-wrapping.
Do it this way:

     def testit(self, REQUEST=None):
         return self.test(self, self.REQUEST, something="blah")

Then you'll be able to use:
<span tal:replace="options/something"/>

--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


More information about the Zope mailing list