Many thanks Dieter. Works fine now. I was confused by this "user" that should have an aq_parent. --Gilles ----- Original Message ----- 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 = userInfo(user)" (line 234). : > : > Then userInfo() checks "user.aq_inner.aq_parent" (line 240) : > : > 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. : > : > 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... : : 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. : : 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. : : : Dieter : :