[ZPT] v2 of Path Prefixes in CVS

Shane Hathaway shane at zope.com
Tue Sep 2 12:57:06 EDT 2003


Fergal Daly wrote:
> On Tuesday 02 September 2003 15:55, Shane Hathaway wrote:
> 
>>I see it as a way to be explicit about things we have been doing 
>>implicitly.  "path/mytemplate" is vulnerable to acquiring something 
>>other than a template if some other thing happens to be named 
>>"mytemplate".  But let's say you write a prefix called "templates" that 
>>acquires only templates.  "path/templates:mytemplate" would then let you 
>>be sure that you're acquiring a template.
> 
> 
> Penny is dropping, this all comes down to acquisition. I had assumed that 
> acquisition was something that had been implemented at the python class level 
> but, correct me if I'm wrong, acquisition is handled at the TALES level and 
> this is to allow namespacing to avoid acquisition clashes? That's fair 
> enough.

Acquisition is indeed at the Python class level, but it has always been 
unpredictable and mysterious.  Zope 3 will therefore drop implicit 
acquisition, but implicit acquisition makes templates easy to write, 
therefore we need something to take its place.  This is it.  To smooth 
the transition, we should also introduce prefixes in Zope 2.

> One complaint still hasn't been addresses. I still think prefixes should be 
> defined in your server setup rather than in your templates. If Zope 2 hasn't 
> got the machinery to do that then I think it would be better to give it the 
> machinery rather than adding define="prefix ..." to TAL. Otherwise you still 
> have the problem of having to put lots of defines into your templates or 
> having templates which exist purely as include files containing definitions, 
> neither of which is very nice,

The server will have built-in prefixes, yes.  Zope 3 will probably even 
have site-specific prefixes.  However, it will sometimes be important to 
depend on a particular prefix in a template, to solve versioning issues 
or whatever other configuration management problem that might come up. 
Ideally, not many templates will use tal:define="prefix ...".

Shane




More information about the ZPT mailing list