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

Chris Withers chris at simplistix.co.uk
Tue Jan 30 09:44:57 CET 2007


Philipp von Weitershausen wrote:
> It's not always about actually *using* context or request. These two can 
> also serve as keys for the lookup. The skin is expressed as a marker 
> interface on the request, so for different skins you could have 
> different versions of the 'mymacro' view, hence different macros for 
> your templates.

Can you give me an example of how this would work or where I can look to 
see real code? It sounds like a reasonable use case, but I can't quite 
get my head around it...

>> Well, my way wasn't much typing, but I hit a problem.
>>
>> <browser:page name="mymacro" template="my_macro.pt" ... /> seems to 
>> have a TAL version of 1.5.
>>
>> Products.Five.browser.pagetemplatefile.ViewPageTemplateFile seems to 
>> instantiate templates with a TAL version of 1.6.
> 
> That's hard to believe. Couldn't it be you're confusing Zope3's 
> *zope.app.pagetemplate*.ViewPageTemplateFile with Five's one?

Please find attached a minimal example. I'm using Zope 2.9.4 and all the 
files were in lib/python of the instance. The zcml file was included 
with the following in site.zcml:

   <include files="../lib/python/view.zcml" />

Any help greatfully received!

cheers,

Chris

PS: Putting this together, I noticed another thing... am I right in 
thinking that:

<five:traversable class="OFS.Application.Application" />

...doesn't work? As you'll see in the minimal example, I had to bind to 
OFS.Folder.Folder instead and then create a dummy folder so I could test 
the view in a browser.

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: view.zcml
Url: http://codespeak.net/pipermail/z3-five/attachments/20070130/bcc03061/attachment.diff 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/z3-five/attachments/20070130/bcc03061/attachment.htm 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/z3-five/attachments/20070130/bcc03061/attachment-0001.htm 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.py
Url: http://codespeak.net/pipermail/z3-five/attachments/20070130/bcc03061/attachment-0001.diff 


More information about the z3-five mailing list