[Zope] Problem with __before_publishing_traverse__

Dieter Maurer dieter at handshake.de
Fri Mar 23 16:59:48 EDT 2007


Peter Bengtsson wrote at 2007-3-23 13:29 +0000:
>I have a product that looks like this::
>
>class MyApp(Something):
>   meta_type = 'x'
>   def foobar(self):
>       """ doc str """
>       return "xxx"
>   def __before_publishing_traverse__(self, object, request=None):
>       print "HOUSTON"
> ...
>When I view objects of this class I'd expect Zope to call the 
>__before_publishing_traverse__ hook and print HOUSTON, but it doesn't :(
> ...
>             if object.__class__.__name__ == 'MyApp':
>                 print object.foobar()
>                 print object.foobar
>                 print object.__before_publishing_traverse__(object, self)
>                 print bpth
>          path = request.path = request['TraversalRequestNameStack']
>
>
>
>When I look at the output of this I get:
>
>xxx
><bound method MyApp.foobar of <MyApp at /IMS>>
>None

Maybe, instead of "foobar", you should print "__before_publishing_traverse__".

  "Five" started to fiddle around with "__before_publishing_traverse__"
  (to make Zope 3 traversal available) and maybe this introduced
  the bug no longer to call the existing "__before_publishing_traverse__"?



-- 
Dieter


More information about the Zope mailing list