Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #415 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

identity error when login info POSTed twice

Reported by: Max <ischenko@…> Owned by: anonymous
Priority: normal Milestone: 0.9
Component: Identity Version: 0.9a6
Severity: major Keywords:


The following course of actions yields an internal error:

  1. Go to 'login' screen to enter user info.
  2. Successfully returned to previous page.
  3. Hit F5 (Refresh) and answer "YES" to report form data.
  4. Got the error below.
500 Internal error

The server encountered an unexpected condition which prevented it from fulfilling the request.

Page handler: "Duplicate entry '1' for key 2"
Traceback (most recent call last):
  File "d:\projects\3rd-party\turbogears\thirdparty\cherrypy\cherrypy\_cphttptools.py", line 96, in _run
  File "d:\projects\3rd-party\turbogears\thirdparty\cherrypy\cherrypy\filters\__init__.py", line 131, in applyFilters
  File "d:\projects\3rd-party\turbogears\turbogears\visit.py", line 106, in before_main
    plugin.record_request( visit.id )
  File "d:\projects\3rd-party\turbogears\turbogears\identity\visitor.py", line 157, in record_request
    identity= self.identity_from_request(visit_id)
  File "d:\projects\3rd-party\turbogears\turbogears\identity\visitor.py", line 83, in identity_from_request
    identity= source(visit_id)
  File "d:\projects\3rd-party\turbogears\turbogears\identity\visitor.py", line 137, in identity_from_form
    identity= self.provider.validate_identity( user_name, pw, visit_id )
  File "d:\projects\3rd-party\turbogears\turbogears\identity\soprovider.py", line 190, in validate_identity
    link= TG_VisitIdentity( visit_id=visit_id, user_id=user.id )
  File "d:\projects\3rd-party\turbogears\thirdparty\sqlobject\sqlobject\main.py", line 1197, in __init__
    self._create(id, **kw)
  File "d:\projects\3rd-party\turbogears\thirdparty\sqlobject\sqlobject\main.py", line 1224, in _create
  File "d:\projects\3rd-party\turbogears\thirdparty\sqlobject\sqlobject\main.py", line 1248, in _SO_finishCreate
    id, names, values)
  File "d:\projects\3rd-party\turbogears\thirdparty\sqlobject\sqlobject\dbconnection.py", line 752, in queryInsertID
    return self._dbConnection._queryInsertID(
  File "d:\projects\3rd-party\turbogears\thirdparty\sqlobject\sqlobject\mysql\mysqlconnection.py", line 78, in _queryInsertID
    self._executeRetry(conn, c, q)
  File "d:\projects\3rd-party\turbogears\thirdparty\sqlobject\sqlobject\mysql\mysqlconnection.py", line 60, in _executeRetry
    return cursor.execute(query)
  File "C:\Python24\lib\site-packages\MySQLdb\cursors.py", line 137, in execute
    self.errorhandler(self, exc, value)
  File "C:\Python24\lib\site-packages\MySQLdb\connections.py", line 33, in defaulterrorhandler
    raise errorclass, errorvalue
IntegrityError: 1062

Change History

comment:1 Changed 13 years ago by Jorge Godoy <jgodoy@…>

Works in PostgreSQL... Maybe something related to what kind of tables your MySQL is using?

comment:2 Changed 13 years ago by Max <ischenko@…>

I'm using default table type (InnoDB?), schema created with tg-admin.

comment:3 Changed 13 years ago by Jeff Watkins

  • Status changed from new to closed
  • Component changed from CherryPy to Identity
  • Resolution set to fixed

I was calling the get method instead of the by_visit_id method. This is why it would be SO nice if SQLObject allowed dependant primary keys instead of insisting on auto-incrementing keys. I really want the primary key of tg_visit_identity to be EXACTLY the same as the primary key of the tg_visit table, but that's against SQLObject policy.

This is fixed in r548.

Note: See TracTickets for help on using tickets.