[z3-five] (re)using zpt macros from view page templates

Chris Withers chris at simplistix.co.uk
Mon Jan 29 12:17:17 CET 2007


Maciej Wisniowski wrote:
>>> Isn't it sufficient to register the template through ZCML?
>>>     
>> ...then we're looking at least at an adapter looking, probably some 
>> security checks in the traversal, and who knows what else.
>>   
> Even default zope skins are views that consist
> of other views (zope.app.basicskin.standardmacros).

You say that like that means it's a good thing... ;-)

>> Is there anything wrong with just having the page template as a 
>> module-level global and importing from there?
> And what about base view like:
> 
> class MyBaseView(BrowserView):
>     my_macro = ZopeTwoPageTemplateFile('macros.pt')
> 
> class MyView(MyBaseView):
> 
>      def getMacro(self):
>          return self.my_macro.macros['template']

Yup, that's another possibility :-)

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the z3-five mailing list