Hi, I've seen the following code in the BITS product which adds roles to zope. ROLES=['Projectmanager','Teammember','Teamleader','ZMI'] for role in ROLES: self.REQUEST.set('role',role) self.manage_defined_roles(submit='Add Role',REQUEST=self.REQUEST) this piece of code is called when adding an instance of the product. Hope it is helpfull. Greets, Daniel
-----Original Message----- From: Samir Mishra [mailto:SamirMishra@cbuae.gov.ae] Sent: dinsdag 18 februari 2003 5:25 To: 'zope@zope.org' Subject: RE: [Zope] Adding Role Programmatically
Oops - the code should have read newfolder._addRole('Reviewer')
I changed the above to ...manage_addRole(... otherwise Zope was not allowing me to save the code (or perhaps that was my browser making it seem that way). And it's the above line that generated the error message - Line 20: "_addRole" is an invalid attribute name because it starts with "_".
Sorry about the confusion this may have caused. I'm still looking for a solution, but I can't figure it out. The source code indicates I ought to be able to use "_addRole".
Thanks again.
SM
-----Original Message----- From: Dieter Maurer [mailto:dieter@handshake.de] Sent: Monday, February 17, 2003 22:49 To: Samir Mishra Cc: 'zope@zope.org' Subject: Re: [Zope] Adding Role Programmatically
Samir Mishra wrote at 2003-2-17 09:49 +0400:
This is probably simple, but I'm unable to find anything on it.
I'm trying to add a new role to a new folder using a Python script, and am using - context.manage_addFolder(fldr, folders[fldr], 1, 1) # folders is a dictionary # create a new folder named 'fldr' newFolder = getattr(context, fldr) # create reviewer role in folder newFolder.manage_addRole('Reviewer')
The last line generates the following error - Line 20: "_addRole" is an invalid attribute name because it starts with "_".
Are you sure?
I do not see "_addRole" in your code.
Maybe, you post the traceback (and the precise error message) as well.
Dieter
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )