[Zope-dev] A z3c.jbot without a monkey

Fred Drake fdrake at gmail.com
Fri Jan 18 12:11:43 EST 2008


On Jan 18, 2008, at 11:58 AM, Brian Sutherland wrote:
> What about zope.pagetemplate.interfaces.IPageTemplate?

Good, because there are no new interfaces that way.

> Personally I like the way z3c.form.form.BaseForm approaches this:
>
>    def render(self):
>        '''See interfaces.IForm'''
>        # render content template
>        if self.template is None:
>            template = zope.component.getMultiAdapter((self,  
> self.request),
>                IPageTemplate)
>            return template(self)
>        return self.template()

That almost supports the use case.  Do the adaptation first, then use  
self.template if there's no adapter, and you're golden.

If a view needs more than one template, it can use names to  
distinguish the cases.


   -Fred

-- 
Fred L. Drake, Jr.    <fdrake at gmail.com>



More information about the Zope-Dev mailing list