Subject: [Zope-dev] change ownership

Tim McLaughlin tim@BCSWebservices.net
Fri, 11 May 2001 12:47:08 -0400


Magnus,

OK, here goes the evil workaround....
It seems that getUser does not return an acquisition wrapped object, so make
your external method this to wrap it (thus giving ownerinfo the ability to
determine the user db):

def setOwner(self, username):
    #note: this assumes that the closest User database houses 'username'
    user = self.acl_users.getUser(username)
    self.changeOwnership(user.__of__(self.acl_users))
    return 'done.'

--Tim McLaughlin (tmclaugh)

-----Original Message-----
From: Magnus Heino (Rivermen)
To: 'Tim McLaughlin'; Magnus Heino (Rivermen)
Sent: 5/11/01 1:20 AM
Subject: SV: Subject: [Zope-dev] change ownership


> could you give me a url, name & pw, and let me take a look at 
> the zclass?

Nope, I'm doing this on my laptop behind a firewall.

But, this is how to reproduce it;


This is my external method:

[magnus@daysleeper Extensions]$ cat Owner.py
def setObjectOwner(self, username):
        self.changeOwnership(self.acl_users.getUser(username))
        return '%s is now the owner of %s' % (username, self.id)
 
def getObjectOwner(self):
        return self.getOwner()
[magnus@daysleeper Extensions]$

Goto Control_Panel/Products. Add a product 'FooProduct'. Enter the
FooProduct and create a ZClass with id and metatype 'FooClass'.

Enter the FooClass and add a External Method. Set Id and Function Name
to
'setObjectOwner'. Module name is 'Owner'.

Go to the Root zope folder. It contains a standard acl_users.

Add a FooClass named 'foo'.

Call the external method on the object like this:

http://192.168.237.105:8080/foo/setObjectOwner?username=magnus

magnus is my username that lives in the acl_users.

You get the Attributeerror on aq_inner. 

Any clues? :-P

Thanks.

/Magnus