Accessing acl_users in __init__() of Python Product
Hi! I need to access acl_users of the parent in the constructor of a python product. Acquisition seems to fail in this situation. Any hints? The function for creating the Python Product looks like this: def manage_addOOPServer(dispatcher, id=0, REQUEST=None): "Add a new OOPServer" oopserver=OOPServer(id) dispatcher._setObj(id, oopserver) Please CC to me, I am not on the list. thomas
Thomas Güttler wrote:
Hi!
I need to access acl_users of the parent in the constructor of a python product. Acquisition seems to fail in this situation.
Any hints?
The function for creating the Python Product looks like this:
def manage_addOOPServer(dispatcher, id=0, REQUEST=None): "Add a new OOPServer" oopserver=OOPServer(id) dispatcher._setObj(id, oopserver)
Please CC to me, I am not on the list.
thomas
_______________________________________________ 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 )
get the object via obj = getattr(dispatcher,id) then it should have the acquisition cheers, bernd
There is no acquisition context before _setObject(). Use manage_afterAdd() for logic requiring an acquisition context. Stefan --On Mittwoch, 02. Juli 2003 17:28 +0200 Thomas Güttler <tguettler@thomas-guettler.de> wrote:
I need to access acl_users of the parent in the constructor of a python product. Acquisition seems to fail in this situation.
Any hints?
-- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/
Thomas Güttler wrote at 2003-7-2 17:28 +0200:
I need to access acl_users of the parent in the constructor of a python product. Acquisition seems to fail in this situation.
When you think about it you will recognize that the object cannot be acquisition wrapped in the constructor. Or expressed differently: it cannot yet know its parent. You must pass the parent into the constructor (when you need it there) or delay your parent dependent operation until "manage_afterAdd". Be careful, though, as "manage_afterAdd" is called also during copy and import. Dieter
participants (4)
-
Bernd Dorn -
Dieter Maurer -
Stefan H. Holek -
Thomas Güttler