__before_publishing_traverse__ problem (2 args only)
Hi, I have a Python product which defines a __before_publishing_traverse_ method. At last I thought it would all work fine now... Now I added one of my User Folder objects and got an exception because __before_publishing_traverse__ was called with only two arguments instead of three. Quite curious (because of course I don't call this method myself) I had a look at ZPublisher/BaseRequest.py, line 251, and noticed it is called there without providing the REQUEST. When I monkeypatched this method to hand over the request as the third argument, Zope complained that the "global name 'UNSPECIFIED_ROLES'" was not defined (and nothing worked anywhere anymore). So should I make the REQUEST an _optional_ argument to my __before_publishing_traverse__ method? But the purpose of my b.p.t. method is to remove up to two path elements from REQUEST['TraversalRequestNameStack'] and set request variables appropriately, so what is the purpose of this call in BaseRequest? Is there an article anywhere which explains the whole topic in an understandable way? Thanks, Tobias (Zope 2.6.2,
Tobias Herp wrote at 2003-10-20 15:15 +0200:
I have a Python product which defines a __before_publishing_traverse_ method. At last I thought it would all work fine now...
Now I added one of my User Folder objects and got an exception because __before_publishing_traverse__ was called with only two arguments instead of three.
In "Products.CMFCore.DynamicType.DynamicType.__before_publishing_traverse" I see code like: def __before_publishing_traverse__(self, arg1, arg2=None): """ Pre-traversal hook. """ # XXX hack around a bug(?) in BeforeTraverse.MultiHook REQUEST = arg2 or arg1 Apparently, your problem has been observerd by others and they worked around it this way. Dieter
participants (2)
-
Dieter Maurer -
Tobias Herp