[Zope3-dev] Re: Better access to APIs in paths (was Re: needing viewsclues - template/title troubles)

Evan Simpson evan@4-am.com
Mon, 24 Feb 2003 10:40:00 -0600


Shane Hathaway wrote:
>> <html tal:namespaces="dc http://purl.org/dc/elements/1.1/;
>>                       zope http://namespaces.zope.org/zope">

> "context/zope:services/events/dc:title" is allowed and probably common.

I like this a lot.  Given what I've read earlier in this thread, doesn't 
this (sort of) boil down to 'dc(zope(context).services.events).title', 
where 'dc' and 'zope' are aliased to Interface Adapters?  The path form 
actually "reads" better in this case, since you can scan it 
left-to-right or right-to-left instead of inside-out.

I'm not sure whether I am stretching the concept too far, but consider 
the following:

<html tal:namespaces="sf http://namespaces.zope.org/string-formats">
...
<span tal:replace="item/total/sf:money">$1,000.00</span>

That is, 'sf(item.total).money()', where 'item.total' is a number, and 
the 'string-formats' Adapter wraps it in an Interface capable of 
converting it into a localized currency string, among many other formats.

Cheers,

Evan @ 4-am