Subject: [Zope-dev] change ownership

Tim McLaughlin tim@BCSWebservices.net
Thu, 10 May 2001 08:18:56 -0400


I call the external method like this from DTML...

set_owner(restrictedTraverse(path_to_user)),

where path to user is a physical path, but I'm using the ZUserFolder, so I
can use the restrictedTraverse to get to users.  UserFolder has a different
API.  You could do this if your acl_users is a standard UserFolder...

set_owner(acl_users.getUser(user_name))

in DTML or make your external method this...

def set_owner(self, user_name):
  self.changeOwnership(self.acl_users.getUser(user_name))

OK, so that should keep you busy for a while.  Anyway, the point is that the
parameter to changeOwnership is a User _object_.  Good luck.

--Tim

-----Original Message-----
From: Magnus Heino (Rivermen) [mailto:magnus.heino@rivermen.se]
Sent: Thursday, May 10, 2001 7:25 AM
To: 'Tim McLaughlin'; 'zope-dev@zope.org'; Magnus Heino (Rivermen)
Subject: SV: Subject: [Zope-dev] change ownership



I can get it to work :-/

I get an attributeerror on aq_inner in lib/python/AccessControl/Owned.py,
line 302, in ownerInfo

Seems as if the user i provide isn't of the right type?

How do you use your method? How is it being called?

/Magnus

> Magnus,
> No, changeOwnership is not exposed for TTW calling.  But you 
> can expose it
> through an external method...  I used this one on a ZClass.
> 
> def set_owner(self, user):
>     self.changeOwnership(user)
>     return