[Zope] Problem with __before_publishing_traverse__
Peter Bengtsson
peter at fry-it.com
Wed Mar 28 05:40:59 EDT 2007
Sorry for late reply.
There is no Five in this environment. The "solution" was to remove the
CookieCrumbler instance inside the MyApp instance. CookieCrumber (1.2)
doesn't have a __before_publishing_traverse__ method but it does have
this (CookieCrumbler.py:214)::
def __call__(self, container, req):
'''The __before_publishing_traverse__ hook.'''
resp = self.REQUEST['RESPONSE']
try:
attempt = self.modifyRequest(req, resp)
except CookieCrumblerDisabled:
return
if req.get('disable_cookie_login__', 0):
return
...more stuff I don't understand...
I tried setting up a similar environment (quickly) and a simple
application that uses __before_publishing_traverse__() but could get it
to stop working just because I put in a CookieCrumber instance :(
Removing the CookieCrumbler object obviously isn't a good enough
solution because we need it for pretty logins. At the moment I don't
understand how CookieCrumbler could have anything to do with it. It's
stuff it does surrounding the REQUEST looks sane and I don't understand
how it could effect my application.
Dieter Maurer wrote:
> 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__"?
>
>
>
--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
More information about the Zope
mailing list