[ZPT] Re: [Zope3-dev] Re: Re: RFC: TALES adapters and TAL/Tales variable namespaces

Jim Fulton jim at zope.com
Fri May 28 11:54:56 EDT 2004


I want to thank everyone who's participating in this
thread. The input is extremely valuable.

Garrett Smith wrote:
> Jim Fulton wrote:
> 
>  > We don't.  In fact, one could argue that adaptation is a bit like
>  > a different kind of traversal. In fact, in Zope 3, we already have
>  > a notion of this. In general, in Zope 3 paths, we can say:
>  >
>  >   foo/++namespace++name
>  >
>  > where "/++namespace++" can be thought of as a special form of
>  > namespace operator (similar and partly inspired by xpaths
>  > "/:namespace:").
>  >
>  > So, we could also use something like:
>  >
>  >   content/++adapter++dc/title
>  >
>  > but I think people want something more concide for ZPT.
> 
> I prefer this notation, even though it's more verbose. I think it should 
> be supported along with a short cut syntax.
> 
> This problem seems analogous to view lookup -- 
> "content/++view++index.html" and "content/@@index.html" are equivalent.
> 
> So, applied to adapters, we could use:
> 
>   content/++adapter++dc/title (or '++adapt++')
> 
> one could use:
> 
>   content/##dc/title
> 
> or perhaps (yuckier):
> 
>   content/**dc/title
> 
> I'd hate to see Yet Another Traversal Syntax introduced

Too late. :) Path expressions already introduce separate syntax.
This is, in part, to take advantage of the TALES variable namespaces,
which aren't relevent to generic path traversal.

 > when we already
> have a decent pattern established.

We are talking about two different systems here.
The ++namespace++name syntax is part of Zope's generic path execution
machinery, which Zope 3 TALES uses.  When we use this syntax, or @@name.
all of the work is done by the namespace machinery, not by TALES. This means
that TALES has no control over it.

So, if you rely solely on the standard traversal machinery, you won't
be able to define short names within the template.

I suggest that whatever short syntax we come up with should be handled by
TALES, not the standard path traversal machinery.

Given that, I still prefer context#dc to context/##dc.

Jim


-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org



More information about the ZPT mailing list