[Zope] Problem with __before_publishing_traverse__
Peter Bengtsson
peter at fry-it.com
Fri Mar 23 09:29:11 EDT 2007
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
More information about the Zope
mailing list