UnboundLocalError: local variable 'evaluate' referenced before assignment

Issue #1648 resolved
Former user created an issue

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)

  1. Former user 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 and ouverts is just a Python list)

  2. Former user 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?

  3. Former user 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.

  4. Former user 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.

  5. Log in to comment