← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 857105] Re: bug in __leaf_to_sql (params is unassigned in certain cases))

 

*** This bug is a duplicate of bug 854522 ***
    https://bugs.launchpad.net/bugs/854522

If I see correctly, the only place where params is left unaassigned is
the case with a 'pass' statement and a comment pretending it should
never happen.

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to OpenERP Project Group.
https://bugs.launchpad.net/bugs/857105

Title:
  bug in __leaf_to_sql (params is unassigned in certain cases))

Status in OpenERP Server:
  New

Bug description:
  Hi guys!

  I try to search records based on the date of creation. I do something
  like:

  self.search(cr, uid, [('create_date','<',before)], context=context)

  I get an error:

    File "/home/fde/repository/openobject-addons_trunk/mymodule/myfile.py", line 107, in cleanup
      ids = self.search(cr, uid, [('create_date','<',before)], context=context)
    File "/home/fde/repository/openobject-server_trunk/openerp/osv/orm.py", line 2112, in search
      return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
    File "/home/fde/repository/openobject-server_trunk/openerp/osv/orm.py", line 4570, in _search
      query = self._where_calc(cr, user, args, context=context)
    File "/home/fde/repository/openobject-server_trunk/openerp/osv/orm.py", line 4425, in _where_calc
      where_clause, where_params = e.to_sql()
    File "/home/fde/repository/openobject-server_trunk/openerp/osv/expression.py", line 786, in to_sql
      q, p = self.__leaf_to_sql(e, table)
    File "/home/fde/repository/openobject-server_trunk/openerp/osv/expression.py", line 774, in __leaf_to_sql
      if isinstance(params, basestring):
  UnboundLocalError: local variable 'params' referenced before assignment
  > /home/fde/repository/openobject-server_trunk/openerp/osv/expression.py(774)__leaf_to_sql()
  -> if isinstance(params, basestring):

  However, the query is OK:

  (Pdb) query
  '(mymodule_myobject."create_date" < \'2011-09-23 06:27:47.722927\')'

  It seems the error was introduced by Olivier Dony in revision 3642.
  Params should just be assigned to [] before everything.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/857105/+subscriptions


References