[Zope3-dev] PythonProgrammerTutorial

Jim Fulton jim@zope.com
Thu, 06 Dec 2001 07:42:08 -0500


"Phillip J. Eby" wrote:
> 
> At 11:52 PM 12/5/01 +0000, Chris Withers wrote:
> >Jim Fulton wrote:
> > >
> > > Yup. It may very well turn out that semicolons will
> > > not be needed often, through other namespace control
> > > approaches.
> >
> >This, for me, is that best way :-)
> 
> [Also posted to ComponentArchitecture wiki]
> 
> So what's wrong with using a leading "_" as a "meta" or "escape" indicator?
> E.g.:
> 
>      ob/_view/edit
> 
> Meaning, "go to the view namespace, then go to edit".  Yes, it's a naming
> convention. But so far all the Z3 examples and code I've seen outlaw
> leading underscores in path segments. This would make that outlawing
> actually mean something.  :)

Leading underscores won't be outlawed in Zope 3. In fact, in Zope 3, 
the standard Zope security policy probably won't look at names. Any
examples you've seen were due to earlier uncertainty or bad habits.

BTW, the presence or length of doc strings won't be meaningful
either, unless someone writes a component that makes them meaningful
for an application.

> And, of course, this syntax allows for clean relative URL's. If a way to
> specify parameters is needed, perhaps something like this:
> 
>      ob/_view,id=spam,content-type=.Widget/form
> 
> would do the trick. While "," is no more or less valid than ";" in URL's,

The URL syntax *specifically* uses semicolons for parameter passing.

> there are at least other application servers which use "," in URL's, so
> authors of the various clients (including e-mail and other tools which
> highlight in-line URL's and make them linkable) are more likely to have
> been tested with them.
> 
> There is an interesting dilemna for relative URLs when dealing with
> parameters other than a namespace, using almost any approach. Do you keep
> the parameters, or not? My gut feel is no, you don't want to, because the
> other parameters aren't relevant to another URL, which makes me wonder if
> they should be in the "upper" part of the URL at all. But then, maybe I'm
> misunderstanding the purpose of the "id" and "content-type" parameters
> being used as examples.

My gut is that you do want to keep them, or, IOW, you should simply treat
parameters as part of the name when interpreting relative URLS. This is
what I think the spec says, although it's very poorly worded and the give
no examples. 

Jim

--
Jim Fulton           mailto:jim@zope.com       Python Powered!        
CTO                  (888) 344-4332            http://www.python.org  
Zope Corporation     http://www.zope.com       http://www.zope.org