[Zope] object.changeOwnership (con't)

Gilles Lenfant glenfant@bigfoot.com
Sat, 23 Feb 2002 14:47:52 +0100


Many thanks Dieter.

Works fine now. I was confused by this "user" that should have an =
aq_parent.

--Gilles

----- Original Message -----=20
From: "Dieter Maurer" <dieter@handshake.de>
To: "Gilles Lenfant" <glenfant@bigfoot.com>
Cc: <zope@zope.org>
Sent: Saturday, February 23, 2002 1:14 PM
Subject: Re: [Zope] object.changeOwnership (con't)


: Gilles Lenfant writes:
:  > I noticed that in lib/python/AccessControl/Owned.py in the Owned =
class, the "object.changeOwnership(user)"  (line 97) method calls "new =
=3D userInfo(user)" (line 234).
:  >=20
:  > Then userInfo() checks "user.aq_inner.aq_parent" (line 240)
:  >=20
:  > The strange thing is that an user object (from any acl_users) has =
no "aq_inner" nor "aq_parent" attribute. And this raises an =
AttributeError when trying to change ownership.
:  >=20
:  > Did I take a wrong user object type (acl_users.getUser('foo')) or =
is this another bug ?
: I think, it is a bug (that I fixed in LDAPUserFolder), but one can
: have different opinions...
:=20
: Usually (when you get it from "REQUEST.AUTHENTICATED_USER" or
: "getSecurityManager().getUser()",
: the user is wrapped in the UserFolder's acquisition context.
: The above construct, is an idiom to access the object's container,
: i.e. the UserFolder.
:=20
: The "getUser" method of some UserFolders returns unwrapped objects.
: These can not be used with "changeOwnership" (as you found out).
: You can wrap them by: "user.__of__(userFolder)". Of course,
: this requires non-TTW code.
:=20
:=20
: Dieter
:=20
:=20