[Zope] Adding Role Programmatically
Samir Mishra
SamirMishra@cbuae.gov.ae
Tue, 18 Feb 2003 08:25:04 +0400
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