Re[4]: [Zope-CMF] Setting local role programmatically

Rainer Thaden Rainer Thaden <thadi@gmx.de>
Tue, 13 Aug 2002 11:14:46 +0200


Dieter,

DM> Rainer Thaden writes:
DM>  > ...
DM>  > def setOwnerToLocalRoleManager(sci):
DM>  >     obj=sci.object;
DM>  >     userid = obj.getOwner().getId()
DM>  >     obj.manage_setLocalRoles(obj, userid, 'Manager')
                                    ^^^^
Here it is! I did pass the 'self' argument to
def manage_setLocalRoles(self, userid, roles, REQUEST=None):
so the arguments are shifted by one: userid is obj, roles is userid.

Damned!

DM> Maybe, you start debugging.
DM> You can put a "import pdb; pdb.set_trace()" in your
DM> "setOwnerToLocalRoleManager". Zope will stop when it reaches this
DM> line and enter "pdb" (the Python debugger, described in the Python
DM> library reference).

O.K. Now i now how to use the python debugger. Before that I debugged
by writing values to a text file, which also worked, but isn't that
elegant.
By the way: when i use the 'continue' command the program doesn't
continue as usual but stops frequently. How do i coninue the program
in the usual way? Do i have to tell the debugger to stop working?

DM> By the way, the third argument to "manage_setLocalRoles" almost surely
DM> needs to be a sequence, i.e. "('Manager',)" instead of "Manager".
DM> This is not your current problem, but it would be the next one...

Yepp. Already encountered that one and fixed it.


-- 
Regards,
 Rainer                            mailto:thadi@gmx.de