Re: [Zope-CMF] problem in setting local roles for newly created object
On 4/1/06, Dieter Maurer <[EMAIL PROTECTED]> wrote: > Bartek Gorny wrote at 2006-3-29 11:50 +0200: > > ... > >I have a script which creates a new instance of a certain portal_type > >by a method "constructContent", and then calls manage_setLocalRoles. > >And I get an exception: > > > >Module AccessControl.Role, line 362, in manage_setLocalRoles > >AttributeError: __hash__ > > > >and the lines in question are: > >361dict=self.__ac_local_roles__ or {} > >362dict[userid]=roles > > This means, the "userid" does not have a "__hash__" method > and especially is not as string. But, it should be a string! Of course. I did a stupid thing - got a user by getMemberById function, and then tried to use the object to set a local role, instead of the object's id. The misleading thing was that when I tried to print out the 'userid' to a log, it gave the id, with no information that it is an object. Your comment help me figure it out - thanks. Bartek > -- > Dieter > ___ Zope-CMF maillist - Zope-CMF@lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See http://collector.zope.org/CMF for bug reports and feature requests
Re: [Zope-CMF] problem in setting local roles for newly created object
Bartek Gorny wrote at 2006-3-29 11:50 +0200: > ... >I have a script which creates a new instance of a certain portal_type >by a method "constructContent", and then calls manage_setLocalRoles. >And I get an exception: > >Module AccessControl.Role, line 362, in manage_setLocalRoles >AttributeError: __hash__ > >and the lines in question are: >361dict=self.__ac_local_roles__ or {} >362dict[userid]=roles This means, the "userid" does not have a "__hash__" method and especially is not as string. But, it should be a string! -- Dieter ___ Zope-CMF maillist - Zope-CMF@lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See http://collector.zope.org/CMF for bug reports and feature requests
[Zope-CMF] problem in setting local roles for newly created object
Hi I have a script which creates a new instance of a certain portal_type by a method "constructContent", and then calls manage_setLocalRoles. And I get an exception: Module AccessControl.Role, line 362, in manage_setLocalRoles AttributeError: __hash__ and the lines in question are: 361dict=self.__ac_local_roles__ or {} 362dict[userid]=roles Needless to say, if do the same things (constructContent and manage_setLocalRoles) one at a time, it works fine. Does this mean that I should do something in the meantime, after constructContent, to complete object construction before calling setLocalRoles? Or is there other way to set local roles on new object? Bartek ___ Zope-CMF maillist - Zope-CMF@lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See http://collector.zope.org/CMF for bug reports and feature requests