[Zope3-dev] Re: One namespace for ZCML

Martin Aspeli optilude at gmx.net
Mon Feb 13 14:05:41 EST 2006


Martijn Faassen <faassen <at> infrae.com> writes:

> >>What happens if you want to add your own statements? Should you still
> >>do that in your own namespace?
> > 
> > 
> > No. But I don't think that it'll be much of a problem. I expect that not a 
lot
> > of 3rd party packages will need their own set of ZCML directives.

Well, hopefully not, but that doesn't mean it doesn't sometimes make sense. 
Zope should worry about defining what type of configuration ZCML is useful for 
and documenting that. Third party authors should then decide whether their 
configuration fits that same general profile, and if so should be allowed to 
add their own ZCML directives. 

And these sure as hell ought to use namespaces, because they are not part of 
the core Zope namespace. Specifically, they can never be part of any core Zope 
ZCML DTD (and there really should be one!), and they should really have their 
own DTD to validate against. For this to work, they *must* have a separate 
namespace. Flatting the namespace in order to save a few characters of typing 
is akin to braking XML conventions and standards, and not for very good reason.

> Currently I know of five and union.cms doing it. I'm certainly 
> considering doing so for Silva. Then there's the example of many 
> packages in the Zope 3 core which are actually quite independent from 
> the core itself, such as the email package, and may in the future become 
> Zope extensions.
> 
> I'd say adding a namespace is a common method for abstracting 
> application specific component configuration tasks. I also don't see 
> what's bad about it and why we'd like to discourage it.

Namespaces are the de-facto way of doing application domains in XML. I really 
don't understand why people fret so much about them. All you have you do is to 
put in your root node:

xmlns:myPrefix="http://mysite.com/dtd/myschema"

That URL doesn't need to be real, it just needs to be a unique identifier. And 
you can choose whatever prefix you want, so if you don't like to type browser, 
how about just b?

I think encouraging third-party developers who *do* need ZCML (and there will 
be times when that makes sense) to not use their own namespace is to ignore 
one of the main conventions of XML and thus become a poor "XML citizen".

I agree that ZCML could use some slimming down, and if that lands us with 
something that semantically all belongs in a single "zope" namespace (and 
recall, if I want, I could use "zope" as the main unnamed namespace or 
explicit use a prefix for it) so be it. 

But if I write an application that needs some configuration or wiring that 
logically belongs in ZCML, I shouldn't have to invent my own config file 
format and I shouldn't be inventing my own names in a namespace I don't own. 

It's kind of the same as saying that all variables in Python should be global 
because you don't like to write 'from module import foo'. Well ... tough. :)

Martin



More information about the Zope3-dev mailing list