Opened 7 years ago

Closed 7 years ago

#6138 closed defect (worksforme)

_ensure_user_data method fault

Reported by: jan.hadas@… Owned by: Morris
Priority: normal Component: FlexibleAssignToPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11


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: - 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 7 years ago by Morris

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:

The final return from getUsers() should be a *unique* list of SimpleUser instances (no checks for uniqueness are guaranteed to be performed on the list of returned users).

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 from getUsers(). If your implementation of getUsers() isn't returning a unique users list, then the subsequent INSERTs attempted by the ensure_user_data code will fail on the first duplicated user.

comment:2 Changed 7 years ago by jan.hadas@…

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 7 years ago by jan.hadas@…

Resolution: worksforme
Status: newclosed

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.

Modify Ticket

as closed The owner will remain Morris.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.