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

Barry Pederson bp@barryp.org
Mon, 24 Feb 2003 11:36:51 -0600


Shane Hathaway wrote:
> Evan Simpson wrote:
>> 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.
> 
> 
> That's not stretching it at all.  That would be wonderful!
> 
> I envision a "NamespaceResolution" service that, given an object and a 
> namespace, returns a component.  It might use adapters under the covers.

Is it really necessary to hide what's going on under pseudo-XML 
namespace declarations, that people may confuse with real XML 
namespaces?  How about something more upfront like:

<html tal:adapters="dc IZopeDublinCore; sf IStringFormats">
...

Perhaps by default, a "dc IZopeDublinCore" adapter could be predefined, 
so template writers wouldn't have to explicitly declare it, although 
they could perhaps override it for whatever reason.

I'd think the implementation would be much simpler, not having to map 
those "namespaces" to real adapter names.

     Barry