[Zope] help with __bobo_traverse__

Mohamed Lrhazi mohamed at your-site.com
Thu May 27 13:06:36 EDT 2004


Newbie here.

I am writing a Product called YSPanel. I installed on the root folder.

I have a published method called: viewDomain, which simply displays the 
REQUEST dict for now. I can call it fine through: 
<http://10.0.10.28:8080/yspanel/viewDomain>


Now I'd like the same method to be called to handle a URL like:

<http://10.0.10.28:8080/yspanel/foobar/1/2/3/4>


So I added this to my class:

def __bobo_traverse__(self,REQUEST=None,NAME=None):
      if NAME == 'foobar':
	#gettattr_str = str(getattr(self, 'viewDomain'))
	#self_str = str(self)
	#err_str = "gettattr_str:%s \n self_str:%s"%(gettattr_str,self_str)
	#raise 'Ooops', err_str
	return getattr(self, 'viewDomain')
      else:
           # probably from unrestrictedTraverse
           return getattr(self, NAME)

When try it I get:

Zope has encountered a problem publishing your object.
Cannot locate object at: http://10.0.10.28:8080/yspanel/foobar/1

Note when I uncomment my debugging lines above, I get what seems correct:

gettattr_str:	<bound method YSPanel.viewDomain of <YSPanel at /yspanel>>
self_str:		<YSPanel at yspanel>

What am I missing here?

What is the right way to handle variables passed via PATH_INFO?

Thanks a lot.
Mohamed~




More information about the Zope mailing list