[Zope-dev] Re: Subpath traversal interface (was RE: ANN: Python
Methods 0.1.7 up and over to DC) and over to DC)
Evan Simpson
evan@4-am.com
Mon, 20 Dec 1999 18:33:59 -0600
Michel Pelletier wrote:
> I, personally, prefer the folderish approach. If a site root is a
> definitive folder, then 'portal' like methods can be placed in it,
I'm not sure I understand what 'portal' methods are. Are we talking about
methods which, for example, should only be used in a SiteObject, and not in
an ordinary folder? Or are they something else?
> The beauty of our solution, I think, is the size
> of the change, absolute URL was actually simplified, one short method
> was added to REQUEST, and a very simple folder object was created that
> overrides absolute_url and __bobo_traverse__. All in all, suprisingly
> little code.
I ended up re-complicating absolute_url for my purposes; I added a check
for self._v_absolute_url, which is returned instead of 'recursive call +
id' when it exists. That way, REQUEST.setURL can get the modified URL into
the acquisition chain without fooling with it, affecting other threads, or
causing a persistent change. Your way is, of course, much easier. Apart
from that, and the addition of the __before hook, SiteAccess is also quite
small (~200 lines).
[path foolery]
> That's pretty nifty. I believe we want that, what we need to figure out
> is the best way to do manipulations like that. You're using a Rule
> object now, probably makes sense at the application level to not change
> that and have identical Rule objects in interface, but investigate how
> it's to be done. If there is a discrete folder object like we have now,
> is the before hook needed at Rule time?
Well, yes, unless you add Rule-aware machinery to the standard Folder class
(or ObjectManager?). I'd hate to have to replace a Folder with a
RuleFolder (or whatever) just because I wanted a Rule in it. Note that
there isn't technically such a thing as a Rule object (in the sense of a
distinct class). Any DTML Method or Document, External Method, or Python
Method can be a Rule. Also, a Rule can manipulate the traversal path more
simply than a __bobo_traverse__ could, since it only concerns itself with
Ids, not actual objects.
Cheers,
Evan @ 4-am