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

Jim Fulton jim at zope.com
Wed Jun 2 08:34:07 EDT 2004


I've updated http://dev.zope.org/Zope3/TALESPathExpressionAdapters
based on comments to date.

I think we are narrowing down on a short syntx of the form:

   ob/##adaptername

where '#' is some character.  See the proposal for reasons.

I've also given the current status there.

Jim


Jim Fulton wrote:
> Jim Fulton wrote:
> 
>> I've posted two proposals:
>>
>>   http://dev.zope.org/Zope3/TALESPathExpressionAdapters
>>
>> Proposes a mechanism for easily using adapters in TALES expressions.
>>
>>   http://dev.zope.org/Zope3/ZPTVariableNamespaces
>>
>> proposes a mechanism for qualifying names defined in TAL and used in
>> TALES expressions.
> 
> 
> Based on initial comments, I've retracted ZPTVariableNamespaces and
> updated:
> 
>   http://dev.zope.org/Zope3/TALESPathExpressionAdapters
> 
> I've thrown out a few more spellings for adapter use:
> 
>   ob->adaptername      context->dc/title
> 
>   ob~adaptername       context~dc/title
> 
>   ob[adaptername]      context[dc]/title
> 
> Of course, Steve suggested:
> 
>   ob:adaptername       context:dc/title
> 
> So far the cast syntax seems to be the most popular:
> 
>   (adaptername)ob      (dc)context/title
> 
> with one dissension. :)
> 
> One disadvantage I see with the cast notation is that it's
> a bit jarring in:
> 
>   a/b/(adapter)c/d
> 
> as the adapter is applied to a/b/c. The order just doesn't
> seem quite right.
> 
> I'd love to get more feedback or suggestions for the syntax.
> 
> As far as in-template definition, I'd like to borrow from Evan's
> work and allow 'adapter' to be used like 'local' or 'global' in
> tal:define:
> 
>   tal:define="adapter dc modules/zope.app.dublincore/IZopeDublinCore"
> 
> Thoughts?
> 
> Jim
> 
> P.S. Thanks for all the comments so far. :)
> 


-- 
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