[z3-five] Re: Using Zope2 page templates with Five

Philipp von Weitershausen philipp at weitershausen.de
Tue Jan 25 17:20:22 MET 2005


Lennart Regebro wrote:

>>> I think that sounds reasonable, but out of interest: What are your 
>>> specific reasons?
>>
>> Zope3-style traversal (@@, ++resource++, etc.) as well as ZPT 
>> traversal adapters to name one, e.g.
>>   * context/zope:title
>>   * context/@@absolute_url/url:quote
>> etc.
> 
> Ah. I don't know these well enough to say that they work or not with the 
> Zope2 templates, so we'll assume they don't. (Pages and menus get named 
> @@something, and that works, but otherwise I don't know.)

Well, I guess since Five takes over traversal when something has been 
treated with <five:traversable>, it won't matter so much. But still, if 
we don't have to choose an engine over another I think we shouldn't.

>> Also, as Martijn pointed out, there are certain subtle differences 
>> that I don't know off of the top of my head (I think wrt i18n etc.).
> 
> OK.

As a matter of fact, if I want i18n to come from the undoubtedly more 
advanced zope.i18n system and not from PTS, I think I'll need the Zope 3 
flavours anyway.

>> Right, so where's the problem. Somebody who uses Five to integrate 
>> with CMF templates probably never wants to (and probably even cannot) 
>> use Zope 3 templates at the same time.
>> So, all Five-based products that have to do with the CMF would use 
>> five:page, all others would use browser:page. Where's the problem?
> 
> Because then, Five/CMF products can not use schemas and widgets, since 
> they are in Zope3 templates. There really is no way around it. All pages 
> must be of the same flavour. Being able to use Zope2 PageTemplates 
> solved so many issues, that I'm not willing to drop it unless a new 
> issue turns up that makes that solution unusable. You obviously (and 
> quite reasonably) will not drop Zope 3 templates. I see no other 
> solution than a config-statement so select which is to be used for the 
> page-directive, if we are to continue to use the same codebase.

Honestly, I don't see the problem. Especially I don't see why Five/CMF 
products couldn't use schemas and widgets. Widgets don't even have 
anything to do with ZPTs, they simply return a string full of HTML that 
the addform/editform ZPTs embed. These ZPTs would simply have to be 
registered as both flavours, once as a Zope2 flavour and another time as 
a Zope3 flavour. Since both systems are separate anyway, having 
different names for them won't matter, so they will not conflict at all.

That way, context/@@standard_macros/page might resolve to a Zope 3 
flavour ZPT while context/@@cmf_macros/main_page could resolve to 
Zope2/CMF-based stuff. In the end, it's really up to the developer. My 
only point is that there is absolutely no reason to predetermine a ZPT 
engine.

>> Explicit is better than implicit.
> 
> Having a configuration statement is explicit.

Well, one wouldn't know off hand what flavour is being used currently. 
You'd have to grep your whole Products folder in order to see which 
flavour is activated... That's a little implicit for me, not talking 
about conflict situations here.

Philipp


More information about the z3-five mailing list