[Zope] How to access Zope root in Script (Python)

Chris Withers chrisw@nipltd.com
Sun, 08 Dec 2002 14:14:13 +0000


Oliver Bleutgen wrote:
> 
> Yes, but I don't know of an analogous concept for zope's or python's 
> object trees (ignoring restrictedTraverse). 

Why are you ignoring restrictedTraverse? That's exactly what the Traversable 
interface (of which it is a part) was built for...

> I thought of restrictedTraverse always just as a utility for the 
> translation of paths into objects.

It is.

> Why do we have an aq_parent, when there is also a 
> restrictedTraverse('..'),

aq_parent is very much an implementation detail, whereas restrictedTraverse is 
an interface who's implementation may or may not need aq_parent to work. 
Squishdot and its postings implement the Traversable interface but do their 
aquisition wrapping differently...

> or, conversly, why is getPhysicalRoot() a 
> python (product) only method while restrictedTraverse('/') does the same 
> and is unrestricted?

That, I suspect, is purely by chance. I see now reason why getPhysicalRoot isn't 
protected identically to restrictedTraverse('/').

cheers,

Chris