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

Shane Hathaway shane@zope.com
Mon, 24 Feb 2003 17:28:38 -0500


Jim Fulton wrote:
> In the example I have, dc was just an API namespace. Later in my note,
> I said I wouldn't actually use that. I'd use:
> 
>   context/api:title
> 
> or just:
> 
>   context/:title
> 
> Given arguments made elsewhere about how unsophisticated the audience
> of this feature is, I wouldn't expect them to be thinking in terms of
> adapters.

The audience would be thinking in terms of avoiding Zope-specific 
references where possible, though.  Without namespaces, Evan's great 
string formatter example isn't very good anymore, since it has to rely 
on a big, changing API:

<span tal:content="item/total/:money">$10,000.00</span>

Can we come up with all useful string formatters (and all their 
permutations) for the first release of Zope 3?  Of course not. 
Namespaces let you depend on specific versions of a relatively small 
API, and that API can be implemented without the rest of Zope.  So how 
would you write the above code without adding a "money" API function? 
(If you have to write some Python code to do it, what is the gain over a 
namespace declaration?)

Namespaces used this way are like Python import statements.  People 
don't find "import sys" to be a burden, so if we use easy-to-remember 
namespaces, why are namespaces a burden?

Don't get me wrong--I support and understand your position.  But I think 
people find namespaces a lot more appealing than they used to, since 
virtually every new XML schema in the past three years uses them heavily.

Shane