diff --git a/swift3/middleware.py b/swift3/middleware.py index 89b08c38..b3088ca4 100644 --- a/swift3/middleware.py +++ b/swift3/middleware.py @@ -313,9 +313,10 @@ class Controller(object): """ Base WSGI controller class for the middleware """ - def __init__(self, req, app, account_name, token, container_name=None, - object_name=None, **kwargs): + def __init__(self, req, app, account_name, token, conf, + container_name=None, object_name=None, **kwargs): self.app = app + self.conf = conf self.account_name = account_name self.container_name = container_name self.object_name = object_name @@ -739,8 +740,8 @@ class LocationController(Controller): return get_err_response('InternalError') elem = Element('LocationConstraint') - if self.location != 'US': - elem.text = self.location + if self.conf['location'] != 'US': + elem.text = self.conf['location'] body = tostring(elem, xml_declaration=True, encoding='UTF-8') return HTTPOk(body=body, content_type='application/xml') @@ -1058,7 +1059,7 @@ class Swift3Middleware(object): token = base64.urlsafe_b64encode(canonical_string(req)) - controller = controller(req, self.app, account, token, conf=self.conf, + controller = controller(req, self.app, account, token, self.conf, **path_parts) if hasattr(controller, req.method): diff --git a/test-requirements.txt b/test-requirements.txt index 96f52260..b08ef206 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,3 +3,4 @@ sphinx nose openstack.nose_plugin coverage +pylint diff --git a/tox.ini b/tox.ini index a9e2452a..c2209163 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py26,py27,pep8 +envlist = py26,py27,pylint,pep8 minversion = 1.6 skipsdist = True @@ -20,6 +20,9 @@ setenv = VIRTUAL_ENV={envdir} NOSE_WITH_COVERAGE=1 NOSE_COVER_BRANCHES=1 +[testenv:pylint] +commands = pylint -E swift3 + [testenv:pep8] commands = flake8