[Zope] How to access Zope root in Script (Python)
Oliver Bleutgen
myzope@gmx.net
Fri, 29 Nov 2002 17:37:58 +0100
Chris Withers wrote:
> Oliver Bleutgen wrote:
>
>> """Return the object obtained by traversing the given path from the
>> object on which the method was called, performing security checks
>> along the way.
>>
>> If an object is not found then the default argument will be returned."""
>
>
> ...but that's perfectly accurate, think of it in terms of directories
>
> c:\zope\folder> cd \
> root.zope.folder.restrictedTraverse('/')
>
> Traversing from something doesn't only mean going further down the tree ;-)
Yes, but I don't know of an analogous concept for zope's or python's
object trees (ignoring restrictedTraverse). I always think of them as
doubly linked list, without an easy method to get to the "root".
I thought of restrictedTraverse always just as a utility for the
translation of paths into objects.
Why do we have an aq_parent, when there is also a
restrictedTraverse('..'), or, conversly, why is getPhysicalRoot() a
python (product) only method while restrictedTraverse('/') does the same
and is unrestricted?
cheers,
oliver