[Zope3-dev] PythonProgrammerTutorial

Martijn Faassen faassen@vet.uu.nl
Wed, 5 Dec 2001 19:49:39 +0100


Chris Withers wrote:
> Jim Fulton wrote:
> > 
> > Is a URL like:
> > 
> >   http://foo.com/engineering/edit;view/action.html
> > 
> > really "nasty"? Isn't that just a tad strong? :)
> 
> No be honest, probably not... I can just imagine trying to explain that to the
> CTO here at NIP :-S
> 
> (and no, I don't have a better solution...)

What about a way to add path elements to instruct the traversal system?
I.e. this would look like this:

http://foo.com/engineering/edit/ns_view/action.html

where 'ns_view' is a special instruction to the traverser (through setting
a flag in the REQUEST context, perhaps).

I realize Jim's document talks about it briefly:

> Put the namespace in a different path segment, as in: ob/view/edit. Of
> course, this doesn't really solve the problem, because we need to be able to 
> distinguish the namespace name from other names. We are left to use naming
> conventions to indicate namespaces.

I'm not convinced a naming convention would be this bad in this case.
One could see it as a special convention to influence the way traversal occurs,
perhaps through the request context. Similar to the way VirtualHostMonster
works.

With a bit of engineering we could even make this prefix configurable in
a placeful way. That way, even if I'm dealing with objects which do
have 'ns_*' attributes in some section of my site (or even the entire site),
I simply reconfigure to respond to 'foo_' prefixes instead. That could
introduce prickly problems, however, so perhaps sticking to a single prefix is
enough.

> Another problem with this approach is that it suggests a level of
> containment that isn't real.

This is already suggested by method calls at the end, which are not
really a level of containment either. Since the way traversal works is
being rewritten as well, it would be a possibility. 

Not that I think the ; syntax is that terrible, though it may confuse
end-users so sensible defaulting is very important.

Regards,

Martijn