[Zope-CMF] How to make content created by a user?

Norman Khine khine@bmpublications.co.uk
Fri, 21 Sep 2001 14:52:30 +0100


Hi Lucas,
Thanks for your reply, but I am getting an error when running the script:

Zope Error
Zope has encountered an error while publishing this resource.

Error Type: NameError
Error Value: global name 'string' is not defined


Any ideas

Thanks

Norman



-----Original Message-----
From: Lucas Hofman [mailto:lucas.hofman@pgs.com]
Sent: Thursday, September 20, 2001 7:48 AM
To: khine@bmpublications.co.uk
Subject: Re: [Zope-CMF] How to make content created by a user?


On Friday 31 August 2001 09:52, you wrote:
> Hi,
> I need to transfer content, that somehow has become created by an
Anonymous
> User, to belong to a Member. Is there a quick way to do this.
>
Hi,

I used the following external method to clean up ownership in all member
directories. It walks through all items and sets the ownership according to
the id of the folder they are in.

+++
def fixMembers (self):
    '''fixes ownership of the home areas'''
    users = self.acl_users
    Members = self.Members
    r=[]
    for i in Members.objectIds():
        try:
            u = users.getUserById(i)
            m = getattr (Members, i)
        except:
            pass
        else:
            if u is not None:
                u = u.__of__(users)
                m.changeOwnership(u,  recursive=1)
                r.append(i + " changed")
            else:
                r.append(i + " not changed")
    return string.join (r,'\n')
---------

Put this script in Extensions dir. Create an external method in the portal
root. and click on the test tab. Create a copy of the Data.fs first....

Good luck,

----
Lucas Hofman
PGS Research                                    work: +47 67514059
PO Box 354                                       fax: +47 67526640
N-1326 Lysaker, Norway                          home: +47 67581373