[Zope] help with __bobo_traverse__

Mohamed Lrhazi mohamed at your-site.com
Fri May 28 01:29:29 EDT 2004


--On Thursday, May 27, 2004 3:45 PM -0700 Karl Anderson <kra at monkey.org> 
wrote:
>>
>> yspanel is an instance of My product though. and I am trying to figure
>> out  how to use __bobo_traverse__  to call a method to handle the above
>> request,  where everything, from foobar and on, is parameters or
>> commands...
>
> I do this in two toy products, BlogFace and BlogTopic.
>
> http://zope.org/Members/karl/index_html/BlogFace/BlogFace
> http://zope.org/Members/karl/index_html/BlogTopic/BlogTopic
> ...


Thank you so much Karl, that was a comprehensive answer. I got it working 
using the second method you showed:

In case this is of use to any one:

My application instance name, or id, is yspanel, now a URL like this:

<http://10.0.10.28:8080/yspanel/dview/arg1/arg2/arg3/any/thing/at/all>

would result in:

<http://10.0.10.28:8080/yspanel>

which would call my normal index_html method with the following list added 
to the REQUEST dict:

REQUEST['YSURLARGS'] = ['dview', 'arg1', 'arg2', 
'arg3','any','thing','at','all']

all thanks to this method added to my class:


  def __before_publishing_traverse__(self, obj, req):
        """
        """
        stack = req['TraversalRequestNameStack']
	stack.reverse()
	if len(stack) and stack[0] == 'dview':
		# stop looking for next obj to publish by emptying stack
		req['TraversalRequestNameStack'] = []
		req['YSURLARGS'] = stack[:]





More information about the Zope mailing list