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"

  index_html = PageTemplateFile(...)

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 :(


I started fiddling with /usr/lib/zope-2.8.8/lib/python/ZPublisher/BaseRequest.py to try to see what's going on. BEFORE (around line 269)::

    while 1:
        bpth = getattr(object, '__before_publishing_traverse__', None)
        if bpth is not None:
            bpth(object, self)
        path = request.path = request['TraversalRequestNameStack']

AFTER::


    while 1:
        bpth = getattr(object, '__before_publishing_traverse__', None)
        if bpth is not None:
            bpth(object, self)
            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


This is on Zope 2.8.8 and I've never had problems with __before_publishing_traverse__ in Zope 2.8's before.
Could it be that something in Zope 2.8.8 has changed?

--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
_______________________________________________
Zope maillist  -  Zope@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 )

Reply via email to