[Zope] help with __bobo_traverse__

sathya sathya at zeomega.com
Thu May 27 13:13:19 EDT 2004


Mohamed Lrhazi wrote:
at first glance
it seems like your python code is not indented properly
ur return statement is not within the if block
> 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~
> 
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )




More information about the Zope mailing list