Opened 15 years ago
Closed 15 years ago
#6138 closed defect (worksforme)
_ensure_user_data method fault
Reported by: | Owned by: | Morris | |
---|---|---|---|
Priority: | normal | Component: | FlexibleAssignToPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description
I set option: ensure_user_data = true in trac.ini and got error: IntegrityError: columns sid, authenticated, name are not unique. This error is raised from line 248 of file: flexibleassignto.py - when method _ensure_user_data() trys to execute INSERT SQL command. I use Trac 0.11.6stable-r0 and Python 2.4.3.
Attachments (0)
Change History (3)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
My getUsers() method returns unique users list, i am sure.
Problem is, that in table session_attribute is row: "problem_user|1|email|some_email". And _ensure_user_data() trys to create this row second time.
This user isn't in known_usernames. I think that _get_allusers_session_info() don't return it because there is not "problem_user|1|name|problem_user_name" row in database.
But i still don't know how were this problem rows inserted in database..
comment:3 Changed 15 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
I have found it:
get_users() method have to set also "fullname" attribute to returned users. If this attribute isn't set, _ensure_user_data() doesn't work properly.
Well, without seeing your code I can't be exactly sure what the problem is, but my hunch is that you're not ensuring uniqueness in your list of users coming from your data source.
Note in section 2c in the How do I use it section of the FlexibleAssignTo docs this bit about your own implementation of the
getUsers()
method:Be sure that the list of SimpleUser objects that you are returning has been unique-i-fied -- e.g., by working with a set object inside of
getUsers()
and returning a list-i-fied cast of that set as the final return fromgetUsers()
. If your implementation ofgetUsers()
isn't returning a unique users list, then the subsequentINSERT
s attempted by theensure_user_data
code will fail on the first duplicated user.