← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 743622] [NEW] UnboundLocalError: local variable 'ids' referenced before assignment

 

Public bug reported:

Install module "city" (addons-extra) and open Address Form, then open
the "Search a resource" button next to the "Location" field ==> it
generates the error (trace is below). The cause of this is a mistake in
indentation in the addons-extra/city/city.py file (see below for the
fix).

$ bzr diff addons-extra/city/city.py
=== modified file 'city/city.py' (properties changed: -x to +x)
--- city/city.py	2011-02-18 20:19:20 +0000
+++ city/city.py	2011-03-27 13:24:31 +0000
@@ -43,7 +43,7 @@
             args = []
         if context is None:
             context = {}
-            ids = []
+        ids = []
         if name:
             ids = self.search(cr, uid, [('zipcode', 'ilike', name)]+ args, limit=limit)
         if not ids:


Environment Information : 
System : Linux-2.6.32-29-generic-x86_64-with-Ubuntu-10.04-lucid
OS Name : posix
Distributor ID:	Ubuntu
Description:	Ubuntu 10.04.2 LTS
Release:	10.04
Codename:	lucid
Operating System Release : 2.6.32-29-generic
Operating System Version : #58-Ubuntu SMP Fri Feb 11 20:52:10 UTC 2011
Operating System Architecture : 64bit
Operating System Locale : en_US.UTF8
Python Version : 2.6.5
OpenERP-Client Version : 6.0.1
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/home/dell/Documents/Projects/openerp-trunk/server/openerp/netsvc.py", line 410, in dispatch
    result = ExportService.getService(service_name).dispatch(method, auth, params)
  File "/home/dell/Documents/Projects/openerp-trunk/server/openerp/service/web_services.py", line 598, in dispatch
    res = fn(db, uid, *params)
  File "/home/dell/Documents/Projects/openerp-trunk/server/openerp/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/dell/Documents/Projects/openerp-trunk/server/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/dell/Documents/Projects/openerp-trunk/server/openerp/osv/osv.py", line 167, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/dell/Documents/Projects/openerp-trunk/server/openerp/addons/city/city.py", line 49, in name_search
    if not ids:
UnboundLocalError: local variable 'ids' referenced before assignment

** Affects: openobject-addons
     Importance: Undecided
         Status: New

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

Title:
  UnboundLocalError: local variable 'ids' referenced before assignment

Status in OpenERP Modules (addons):
  New

Bug description:
  Install module "city" (addons-extra) and open Address Form, then open
  the "Search a resource" button next to the "Location" field ==> it
  generates the error (trace is below). The cause of this is a mistake
  in indentation in the addons-extra/city/city.py file (see below for
  the fix).

  $ bzr diff addons-extra/city/city.py
  === modified file 'city/city.py' (properties changed: -x to +x)
  --- city/city.py	2011-02-18 20:19:20 +0000
  +++ city/city.py	2011-03-27 13:24:31 +0000
  @@ -43,7 +43,7 @@
               args = []
           if context is None:
               context = {}
  -            ids = []
  +        ids = []
           if name:
               ids = self.search(cr, uid, [('zipcode', 'ilike', name)]+ args, limit=limit)
           if not ids:

  
  Environment Information : 
  System : Linux-2.6.32-29-generic-x86_64-with-Ubuntu-10.04-lucid
  OS Name : posix
  Distributor ID:	Ubuntu
  Description:	Ubuntu 10.04.2 LTS
  Release:	10.04
  Codename:	lucid
  Operating System Release : 2.6.32-29-generic
  Operating System Version : #58-Ubuntu SMP Fri Feb 11 20:52:10 UTC 2011
  Operating System Architecture : 64bit
  Operating System Locale : en_US.UTF8
  Python Version : 2.6.5
  OpenERP-Client Version : 6.0.1
  Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
    File "/home/dell/Documents/Projects/openerp-trunk/server/openerp/netsvc.py", line 410, in dispatch
      result = ExportService.getService(service_name).dispatch(method, auth, params)
    File "/home/dell/Documents/Projects/openerp-trunk/server/openerp/service/web_services.py", line 598, in dispatch
      res = fn(db, uid, *params)
    File "/home/dell/Documents/Projects/openerp-trunk/server/openerp/osv/osv.py", line 122, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/home/dell/Documents/Projects/openerp-trunk/server/openerp/osv/osv.py", line 176, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/home/dell/Documents/Projects/openerp-trunk/server/openerp/osv/osv.py", line 167, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/home/dell/Documents/Projects/openerp-trunk/server/openerp/addons/city/city.py", line 49, in name_search
      if not ids:
  UnboundLocalError: local variable 'ids' referenced before assignment



Follow ups

References