[Zope] Re: help with __bobo_traverse__
Mohamed Lrhazi
mohamed at your-site.com
Fri May 28 08:34:38 EDT 2004
--On Friday, May 28, 2004 10:30 AM +0200 yuppie <y.2004_ at wcm-solutions.de>
wrote:
> Hi!
>
>
> Mohamed Lrhazi wrote:
>> def __before_publishing_traverse__(self, obj, req):
>> """
>> """
>> stack = req['TraversalRequestNameStack']
>> stack.reverse()
>
> I doubt you want to do that.
I wont do that. Thanks a lot.
> 'stack' is not a copy. So if your condition
> is not true, TraversalRequestNameStack is screwed up.
>
>> if len(stack) and stack[0] == 'dview':
>> # stop looking for next obj to publish by emptying stack
>> req['TraversalRequestNameStack'] = []
>> req['YSURLARGS'] = stack[:]
>
> Something like that should be better:
>
> def __before_publishing_traverse__(self, obj, req):
> """
> """
> stack = req['TraversalRequestNameStack']
> if stack and stack[-1] == 'dview':
> # stop looking for next obj to publish by emptying stack
> stack.reverse()
> req['TraversalRequestNameStack'] = []
> req['YSURLARGS'] = stack[:]
>
>
> BTW: Why can't you simply use traverse_subpath?
>
Never heard of it :)
Mohamed~
More information about the Zope
mailing list