← Back to team overview

openerp-community-reviewer team mailing list archive

[Bug 1244584] Re: [ocb7.0] survey - sur reference used before assignment

 

Hi

I apply the MP

Thanks,

** Changed in: ocb-addons/7.0
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of OpenERP
Community Backports Team, which is subscribed to OpenERP Community
Backports (Addons).
https://bugs.launchpad.net/bugs/1244584

Title:
  [ocb7.0] survey - sur reference used before assignment

Status in OpenERP Community Backports (Addons):
  Fix Released
Status in OpenERP Community Backports (Addons) 7.0 series:
  Fix Released

Bug description:
  According to runbot here is an introduced error that make fail the
  tests only on OCB branch


  
  http://runbot.openerp.com/ocb-7-0-ocb-23519/logs/test-all.txt

  2013-10-25 00:11:01,653 32082 ERROR 7-0-ocb-23519-all openerp.tools.yaml_import: local variable 'sur' referenced before assignment
  Traceback (most recent call last):
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/tools/yaml_import.py", line 864, in process
      self._process_node(node)
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/tools/yaml_import.py", line 877, in _process_node
      self.process_python(node)
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/tools/yaml_import.py", line 550, in process_python
      unsafe_eval(code_obj, {'ref': self.get_id}, code_context)
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/addons/survey/test/draft2open2close_survey.yml", line 4, in <module>
      I set the survey in Open state.
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/osv/orm.py", line 4326, in create
      vals = self._add_missing_default_values(cr, user, vals, context)
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/osv/orm.py", line 2491, in _add_missing_default_values
      defaults = self.default_get(cr, uid, missing_defaults, context)
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/addons/survey/wizard/survey_send_invitation.py", line 85, in default_get
      + '#id=%d&view_type=form&model=survey' % sur.id)
  UnboundLocalError: local variable 'sur' referenced before assignment
  2013-10-25 00:11:01,655 32082 ERROR 7-0-ocb-23519-all openerp.modules.loading: module survey: an exception occurred in a test
  Traceback (most recent call last):
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/modules/loading.py", line 83, in load_test
      _load_data(cr, module_name, idref, mode, 'test')
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/modules/loading.py", line 122, in _load_data
      tools.convert_yaml_import(cr, module_name, fp, kind, idref, mode, noupdate, report)
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/tools/yaml_import.py", line 928, in yaml_import
      yaml_interpreter.process(yaml_string)
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/tools/yaml_import.py", line 864, in process
      self._process_node(node)
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/tools/yaml_import.py", line 877, in _process_node
      self.process_python(node)
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/tools/yaml_import.py", line 550, in process_python
      unsafe_eval(code_obj, {'ref': self.get_id}, code_context)
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/addons/survey/test/draft2open2close_survey.yml", line 4, in <module>
      I set the survey in Open state.
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/osv/orm.py", line 4326, in create
      vals = self._add_missing_default_values(cr, user, vals, context)
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/osv/orm.py", line 2491, in _add_missing_default_values
      defaults = self.default_get(cr, uid, missing_defaults, context)
    File "/home/odoo/runbot/static/ocb-7-0-ocb-23519/server/openerp/addons/survey/wizard/survey_send_invitation.py", line 85, in default_get
      + '#id=%d&view_type=form&model=survey' % sur.id)
  UnboundLocalError: local variable 'sur' referenced before assignment

  
  Looking at the indentation of the incriminated code confirm the error.

  http://bazaar.launchpad.net/~ocb/ocb-addons/7.0/view/head:/survey/wizard/survey_send_invitation.py
  line 85 sur reference is out of the for loop on surveys.

  It will only fail if there are no active_ids.

  As it it now, default_get method is only designed for a list  of 1
  active_ids, it must be safe with 0 or multiple active_ids.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ocb-addons/+bug/1244584/+subscriptions