[Zope-dev] Re: TALES idea: tuple unpacking

Philipp von Weitershausen philipp@weitershausen.de
Wed, 23 Jul 2003 09:45:04 -0500


Shane Hathaway wrote:
> Here's the way I'd like to spell it:
> 
>   <div tal:repeat="user_files here/listFilesByUser">
>     User: <span tal:replace="user_files/int:0" />
>     File: <span tal:replace="user_files/int:1" />
>   </div>

+1

> We've come up with a number of generally useful prefixes, BTW.  Off the 
> top of my head:
> 
> call:   -- Call a named method
> int:    -- Look up an item by index
> format: -- Perform simple formatting operations like "format:money"
> zope:   -- Access a big Zope API

+1

> It sure would be nice to have these prefixes, both in Zope 2 and Zope 3.

AFAIK, Jim wants this for Zope3 for some time now. The idea is to 
implement this with named adapters.

here/some_object/zope:name would make TALES look up the 'zope' adapter 
(something that implements zope.app.interfaces.talesapi.IZopeTalesAPI) 
and get its name attribute/call its name() method. It would really be a 
two-liner to implement something like an 'int' or 'call' adapter. Other 
named adapters like 'dc' that adapts an object to a Dublin Core 
interface would be nice to have as well. A lot of that is in place 
already, fortunately.

The question remains how to implement this in Zope2 as we don't have 
adapters there.

Philipp