[Zope3-dev] traversing path from scratch

Gary Poster garyposter@earthlink.net
Mon, 6 May 2002 10:39:08 -0400


ok, folks: I have a physical path stored from a traverser

        self.subscriber_path=getAdapter(
            subscriber, ITraverser).getPhysicalPath()

later on, from another method in this object I want to use the stored path to 
get the original object.  If my object were wrapped, this would be easy:

        return getAdapter(self, ITraverser).traverse(self.subscriber_path)

However, I have nothing wrapped available to me at all.  In effect, I want to 
do

        return getAdapter(None, ITraverser).traverse(self.subscriber_path)

However, the default Traverser implementation (Zope.App.Traversing.Traverser) 
needs to have a wrapped object to work with to get the root folder.

Any ideas?  If I could get a wrapped root object I guess that would be good 
enough--can we have a global component that returns a wrapped root folder for 
situations like this?  Is there a reliable way of getting the root folder?  
Should this be turned into a component, if so?  Because of the importance of 
this, I'd be tempted to make it a global service myself, i.e. 
getService(None, 'RootService').getRoot() except that looks kinda stupid and 
I can't think of what else we would use such a service for...

Help?

Thanks

Gary