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 #1589 (closed defect: fixed)

Opened 12 years ago

Last modified 11 years ago

Identity Login fails when using SQLAlchemy

Reported by: simpsomboy Owned by: anonymous
Priority: high Milestone: 1.5
Component: SQLAlchemy Version: 1.1 HEAD
Severity: blocker Keywords: login SQLAlchemy visit identity
Cc:

Description

when using SQLAlchemy, 0.3.1 or 0.4beta6 login attemps fail. it not occurs when using sqlobject

using branche -> 1.1

Traceback (most recent call last):

File "/usr/lib/python2.5/site-packages/CherryPy-2.2.1-py2.5.egg/cherrypy/_cphttptools.py", line 103, in _run

applyFilters('before_main')

File "/usr/lib/python2.5/site-packages/CherryPy-2.2.1-py2.5.egg/cherrypy/filters/init.py", line 151, in applyFilters

method()

File "/usr/lib/python2.5/site-packages/TurboGears-1.1b1dev_r3521-py2.5.egg/turbogears/visit/api.py", line 158, in before_main

plugin.record_request(visit)

File "/usr/lib/python2.5/site-packages/TurboGears-1.1b1dev_r3521-py2.5.egg/turbogears/identity/visitor.py", line 175, in record_request

identity = self.identity_from_request(visit.key)

File "/usr/lib/python2.5/site-packages/TurboGears-1.1b1dev_r3521-py2.5.egg/turbogears/identity/visitor.py", line 96, in identity_from_request

identity = source(visit_key)

File "/usr/lib/python2.5/site-packages/TurboGears-1.1b1dev_r3521-py2.5.egg/turbogears/identity/visitor.py", line 155, in identity_from_form

identity = self.provider.validate_identity(user_name, pw, visit_key)

File "/usr/lib/python2.5/site-packages/TurboGears-1.1b1dev_r3521-py2.5.egg/turbogears/identity/saprovider.py", line 176, in validate_identity

session.flush()

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.3.11-py2.5.egg/sqlalchemy/orm/session.py", line 320, in flush

self.uow.flush(self, objects)

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.3.11-py2.5.egg/sqlalchemy/orm/unitofwork.py", line 210, in flush

flush_context.execute()

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.3.11-py2.5.egg/sqlalchemy/orm/unitofwork.py", line 400, in execute

UOWExecutor().execute(self, head)

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.3.11-py2.5.egg/sqlalchemy/orm/unitofwork.py", line 1018, in execute

self.execute_save_steps(trans, task)

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.3.11-py2.5.egg/sqlalchemy/orm/unitofwork.py", line 1037, in execute_save_steps

self.execute_childtasks(trans, task, False)

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.3.11-py2.5.egg/sqlalchemy/orm/unitofwork.py", line 1055, in execute_childtasks

self.execute(trans, child, isdelete)

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.3.11-py2.5.egg/sqlalchemy/orm/unitofwork.py", line 1018, in execute

self.execute_save_steps(trans, task)

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.3.11-py2.5.egg/sqlalchemy/orm/unitofwork.py", line 1032, in execute_save_steps

self.save_objects(trans, task)

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.3.11-py2.5.egg/sqlalchemy/orm/unitofwork.py", line 1023, in save_objects

task.mapper.save_obj(task.polymorphic_tosave_objects, trans)

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.3.11-py2.5.egg/sqlalchemy/orm/mapper.py", line 1210, in save_obj

c = connection.execute(statement, params)

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.3.11-py2.5.egg/sqlalchemy/engine/base.py", line 517, in execute

return Connection.executors[c](self, object, *multiparams, params)

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.3.11-py2.5.egg/sqlalchemy/engine/base.py", line 557, in execute_clauseelement

return self.execute_compiled(elem.compile(dialect=self.dialect, parameters=param), *multiparams, params)

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.3.11-py2.5.egg/sqlalchemy/engine/base.py", line 568, in execute_compiled

self._execute_raw(context)

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.3.11-py2.5.egg/sqlalchemy/engine/base.py", line 581, in _execute_raw

self._execute(context)

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.3.11-py2.5.egg/sqlalchemy/engine/base.py", line 599, in _execute

raise exceptions.SQLError(context.statement, context.parameters, e)

SQLError: (IntegrityError?) visit_identity.visit_key may not be NULL u'INSERT INTO visit_identity (user_id) VALUES (?)' [None]

Attachments

1589-a.diff Download (662 bytes) - added by simpsomboy 12 years ago.
Patch A modifying identity/saprovider.py
1589-b.diff Download (541 bytes) - added by simpsomboy 12 years ago.
Patch B modifying qstemplates/quickstart/+package+/model.py_tmpl

Change History

Changed 12 years ago by simpsomboy

Patch A modifying identity/saprovider.py

Changed 12 years ago by simpsomboy

Patch B modifying qstemplates/quickstart/+package+/model.py_tmpl

comment:1 Changed 12 years ago by simpsomboy

Hello again! I've found two different ways to resolve it

  1. First one:
  2. Another one:
    • Patching model template adding constructor initialization -> Diff Patch B Download

comment:2 Changed 12 years ago by alexandre

  • Priority changed from normal to high
  • Version set to 1.1b1

saprovider.py can be also merged from 1.0 branch

comment:3 Changed 12 years ago by paj

  • Status changed from new to closed
  • Resolution set to fixed

Ok, committed in [3541]. This reinforces the need to have SA/identity unit tests!

comment:4 Changed 11 years ago by Chris Arndt

  • Version changed from 1.1b1 to 1.1 HEAD
Note: See TracTickets for help on using tickets.