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

Shane Hathaway shane@zope.com
Tue, 25 Feb 2003 16:22:16 -0500


Jim Fulton wrote:
> Now, imagine this exchange:
> 
> [Newbie]
> I just downloaded Zope today and it's really cool.  I made a little
> checkbook register  using a page template.  It's way better than PHP. Now
> I can't figure out how to show only two digits after the decimal point.
> I don't know Python.  Can you help?
> 
> [Guru]
> Use the string formatting API.  Try this (replace "value" with whatever 
> variable you're using):
> 
>   <span tal:content="value/sf:money">$15.00</span>
> 
> [Newbie]
> Hey, neat, that makes sense.
> 
> (feels like groundhog day)

:-)

> 
>>
>> 'nuff said.
> 
> 
> Yup. :)

Ok, cool.

> I really don't think that the declaration adds anything but ceremony in 
> your example.

I agree.  But is it really safe to declare the extra-short acronym "sf" 
for all Zope users everywhere?  A lot of people would think of 
Sourceforge, since "http://sf.net" redirects you to sourceforge.net.

Declaring namespaces in a template makes it more self-contained.  If I 
want to know if I can use a template outside Zope, or in a different 
version of Zope, I have to know what APIs it depends on.  If the 
template declares namespaces, reuse is easier.  If *all* the templates 
I'm interested in reusing declare namespaces, reuse is much easier.

I'm not saying that every template should declare API namespaces, but 
that it should be possible.  I quite like Craeg's "talns:" suggestion, BTW.

Shane