[Zope] Re: traverse_subpath in my product
Evan Simpson
evan at 4-am.com
Fri May 28 12:40:53 EDT 2004
Garito wrote:
> I try to use traverse_subpath in my product but I can't found a real good
> solution
> I found some pages explaining you need to override __bobo_traverse__ or
> __getitem__ in order to implement traverse_subpath on a product but I think
> it's a really poor solution
Much better is to define a __before_publishing_traverse__ method on your
object. Unfortunately, due to a longstanding bug in the hook machinery,
you will need to write your method like this for the moment:
def __before_publishing_traverse__(self, x, request=None):
if request is None:
request = x
# Use self and request normally from here.
Inside your hook method, you can examine and manipulate the stack of
un-traversed path names "request['TraversalRequestNameStack']".
Cheers,
Evan @ 4-am
More information about the Zope
mailing list