On Dec 19, 2011, at 3:30 PM, Iain Duncan wrote:
> Ok, I know this is my fault but maybe someone can help me know what kind of
> error I'm producing here, in saving a user, I'm getting the following
> expection, but only occasionally ( like 10% of the time? )
>
> 15:13:18,160 INFO [xornot.dram.views] EditAction.post() Exception from
> self.update: Can't attach instance <Group at 0xb660d6c>; another instance
> with key (<class 'xornot.auth.model.group.Group'>, (3L,)) is already present
> in this session.
"10% of the time" sounds like a race condition, but this doesn't appear to be
concurrent code, so then maybe something that occurs based on the current shape
of the data (like two #3's somewhere, type of thing)..
Do you have something that's creating new Group objects if one does not exist
already ? You're basically looking to have only one Group(id=3) in the
Session at one time.
>
> I suspect it as to do with this code which tries to add the everyone group to
> everyone before update:
>
> def pre_update_hook(self):
> log.info("UserActionMixing.pre_update_hook()")
> # users can never be removed from the Everyone group
> everyone = self.model.get_by(Group, name='Everyone')
> admin = self.model.get_by(Group, name='Admin')
> if everyone not in self.valid_values['groups']:
> self.valid_values['groups'].append(everyone)
>
> It's a long shot, but does the above info give anyone any idea what kind of
> thing I might be doing wrong and how to track down something like this?
>
> thanks
> Iain
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.