[Erp5-dev] local roles on new object

Bartek Gorny bartek at redpoint.mn.pl
Tue Mar 28 18:47:29 CEST 2006


Hi

I need a script that would create a new object and then set local
roles on it. I tried the following:

obj=event_module.newContent(portal_type='Mail Message')
obj.manage_setLocalRoles('user',('Owner',))

and it returns an error
Module AccessControl.Role, line 362, in manage_setLocalRoles
AttributeError: __hash__

If I only create the object and then set local roles by running
another script, it works fine. It is as if the newly created object
was 'lame' in some way and achieved full functionality only later - is
this the case? I tried inserting commitTransaction in between the two
lines, but it didn't help. How to solve this? Please help.

Bartek

(In case our versions differ, the respective lines in AccessControl.Role are:
361 dict=self.__ac_local_roles__ or {}
362 dict[userid]=roles)



More information about the Erp5-dev mailing list