← Back to team overview

credativ team mailing list archive

[Bug 906115] [NEW] wsgi.py "local variable 'options' referenced before assignment"

 

Public bug reported:

Getting a error when attempting to get connect via webdav.

[2011-12-19 01:00:13,150][?] ERROR:werkzeug:Error on request:
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/Werkzeug-0.7-py2.6.egg/werkzeug/serving.py", line 159, in run_wsgi
    execute(app)
  File "/usr/local/lib/python2.6/dist-packages/Werkzeug-0.7-py2.6.egg/werkzeug/serving.py", line 146, in execute
    application_iter = app(environ, start_response)
  File "/usr/share/pyshared/openerp/wsgi.py", line 398, in application
    result = handler(environ, start_response)
  File "/usr/share/pyshared/openerp/wsgi.py", line 228, in wsgi_webdav
    return return_options(environ, start_response)
  File "/usr/share/pyshared/openerp/wsgi.py", line 246, in return_options
    options += [('DAV', '1 2'), ('Allow', 'GET HEAD PROPFIND OPTIONS REPORT')]
UnboundLocalError: local variable 'options' referenced before assignment


It seems that /usr/share/pyshared/openerp/wsgi.py has a function that is inconsistent with the variable 'option', also referring to it as 'options'

def return_options(environ, start_response):
    # Microsoft specific header, see
    # http://www.ibm.com/developerworks/rational/library/2089.html
    if 'Microsoft' in environ.get('User-Agent', ''):
        option = [('MS-Author-Via', 'DAV')]
    else:
        option = []
    options += [('DAV', '1 2'), ('Allow', 'GET HEAD PROPFIND OPTIONS REPORT')]
    start_response("200 OK", [('Content-Length', str(0))] + options)
    return []

I've tested it by using 'options' and 'option', both remove the error
I'm getting.  I'll leave it to someone who understands that section of
code to make the appropriate choice of 'option' or 'options'

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


** Tags: typo webdav

-- 
You received this bug notification because you are a member of OpenERP
Framework Experts, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/906115

Title:
  wsgi.py "local variable 'options' referenced before assignment"

Status in OpenERP Server:
  New

Bug description:
  Getting a error when attempting to get connect via webdav.

  [2011-12-19 01:00:13,150][?] ERROR:werkzeug:Error on request:
  Traceback (most recent call last):
    File "/usr/local/lib/python2.6/dist-packages/Werkzeug-0.7-py2.6.egg/werkzeug/serving.py", line 159, in run_wsgi
      execute(app)
    File "/usr/local/lib/python2.6/dist-packages/Werkzeug-0.7-py2.6.egg/werkzeug/serving.py", line 146, in execute
      application_iter = app(environ, start_response)
    File "/usr/share/pyshared/openerp/wsgi.py", line 398, in application
      result = handler(environ, start_response)
    File "/usr/share/pyshared/openerp/wsgi.py", line 228, in wsgi_webdav
      return return_options(environ, start_response)
    File "/usr/share/pyshared/openerp/wsgi.py", line 246, in return_options
      options += [('DAV', '1 2'), ('Allow', 'GET HEAD PROPFIND OPTIONS REPORT')]
  UnboundLocalError: local variable 'options' referenced before assignment

  
  It seems that /usr/share/pyshared/openerp/wsgi.py has a function that is inconsistent with the variable 'option', also referring to it as 'options'

  def return_options(environ, start_response):
      # Microsoft specific header, see
      # http://www.ibm.com/developerworks/rational/library/2089.html
      if 'Microsoft' in environ.get('User-Agent', ''):
          option = [('MS-Author-Via', 'DAV')]
      else:
          option = []
      options += [('DAV', '1 2'), ('Allow', 'GET HEAD PROPFIND OPTIONS REPORT')]
      start_response("200 OK", [('Content-Length', str(0))] + options)
      return []

  I've tested it by using 'options' and 'option', both remove the error
  I'm getting.  I'll leave it to someone who understands that section of
  code to make the appropriate choice of 'option' or 'options'

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


Follow ups

References