- changed status to resolved
UnboundLocalError: local variable 'evaluate' referenced before assignment
Out of curiousity I tried SVN trunk on my project here, and got the following error multiple times:
======================================================================
ERROR: rdvopac.tests.test_logement.TestLogement.test_maj_etats_cri
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/nose-0.10.4-py2.6.egg/nose/case.py", line 182, in runTest
self.test(*self.arg)
File "/home/antoine/ftth/rdvopac/rdvopac/tests/test_logement.py", line 203, in test_maj_etats_cri
Logement.maj_etats_cri()
File "/home/antoine/ftth/rdvopac/rdvopac/model/logement.py", line 253, in maj_etats_cri
q.update(dict(etat=cls.ETAT_CRI_INDETERMINE))
File "/usr/lib/python2.6/site-packages/SQLAlchemy-0.6beta1dev_r0-py2.6.egg/sqlalchemy/orm/query.py", line 1733, in update
eval_condition = evaluator_compiler.process(self.whereclause)
File "/usr/lib/python2.6/site-packages/SQLAlchemy-0.6beta1dev_r0-py2.6.egg/sqlalchemy/orm/evaluator.py", line 28, in process
return meth(clause)
File "/usr/lib/python2.6/site-packages/SQLAlchemy-0.6beta1dev_r0-py2.6.egg/sqlalchemy/orm/evaluator.py", line 70, in visit_binary
eval_left,eval_right = map(self.process, [clause.right](clause.left,))
File "/usr/lib/python2.6/site-packages/SQLAlchemy-0.6beta1dev_r0-py2.6.egg/sqlalchemy/orm/evaluator.py", line 28, in process
return meth(clause)
File "/usr/lib/python2.6/site-packages/SQLAlchemy-0.6beta1dev_r0-py2.6.egg/sqlalchemy/orm/evaluator.py", line 31, in visit_grouping
return self.process(clause.element)
File "/usr/lib/python2.6/site-packages/SQLAlchemy-0.6beta1dev_r0-py2.6.egg/sqlalchemy/orm/evaluator.py", line 28, in process
return meth(clause)
File "/usr/lib/python2.6/site-packages/SQLAlchemy-0.6beta1dev_r0-py2.6.egg/sqlalchemy/orm/evaluator.py", line 67, in visit_clauselist
return evaluate
UnboundLocalError: local variable 'evaluate' referenced before assignment
Comments (8)
-
Account Deleted -
Account Deleted Thank you. By the way, it seems the IN criterion doesn't support evaluation. The query at hand is a simple:
db_session.query(cls).filter(cls.id_groupe.in_(ouverts)).update({'ouvert': True})
(where
cls.id_groupe
is the primary key andouverts
is just a Python list) -
Account Deleted Ah, but this is a bit annoying. If I use "fetch" for the synchronize_session parameter, I lose compatibility with 0.5, but if I use "expire", 0.6 raises an error. Could the old "expire" be supported as a synonym?
-
Account Deleted The "evaluate" default seems to cause a silent bug elsewhere in my code. An object in the session which should be updated isn't... I'll try to submit a minimal example.
-
Account Deleted Sorry to insist a bit, but it is possible to support the old "expire" as a synonym for "fetch"? Otherwise achieving compatibility is more annoying than it should be...
Thank you.
-
repo owner -
Account Deleted Thank you :-)
-
repo owner - removed milestone
Removing milestone: 0.6.0 (automated comment)
- Log in to comment
(original author: ants) This is caused by a bug in the error reporting. Actually it should say "Could not evaluate current criteria in Python. Specify 'fetch' or False for the synchronize_session parameter.". There is a note corresponding to that in the 0.6 migration guide. This should be fixed in 700b3a52952529b50f5882657ef2aa9d7c2494b2.