[Zope3-Users] Re: A Few Questions re Namespaces

Philipp von Weitershausen philipp at weitershausen.de
Tue Apr 18 09:31:31 EDT 2006


Jeff Rush wrote:
> I've been working hard reviewing the source to understand
> namespaces, and have most of them figured out but not all.
> 
> 1. Resources are given a __parent__ so they have an
>    absolute_url.  But it seems that views are not.  So
>    they are non-locatable things?

Browser views are locatable. BrowserView inherits from Location.

Other adapters are location-proxied as soon as they need security
protection (permission argument in the <adapter /> directive). This is
necessary so that the security machinery can walk up from the adapter
and find potential local security information. I guess. :).

> 2. I finally found the "+" view in container/browser, but all
>    uses of it are as "/@@+/newitem.html".  I could have sworn
>    I saw the "+" used w/o the "@@" prefix someplace but can't
>    find it again.  Did I indeed imagine ever seeing
>    "/+/newitem.html"?

Nope. Both spellings occur. I prefer /+/ for its brevity, though /@@+/
makes it clearer that it's a view.

> A non-namespace question that I cannot find the answer to in
> either of the Zope books.  I've studied the registry code
> but get lost in the lookup logic.

It *is* explained in my book (p. 243, third bullet point, as well as p.
396, 'for' parameter). There's no entry for it in the index, though. I
will fix that. Thanks.

> 3. What happens if you register a utility or adapter with
>    the -exact- same criteria including the same name?  Does
>    a queryAdapter() lookup return the oldest or newest?
>    Is that a legitimate way of overriding, other than
>    using an overrides.zcml?

ZCML won't let you do that on a global level. It will report a conflict
in the registrations. On a Python level, it's absolutely possible to
override a previous registration of an adapter or a utility with a newer
one. The latest one will always win.

Philipp



More information about the Zope3-users mailing list