tox: add support for pylint

This also fixes a bug detected by pylint.

Change-Id: I378c5766d375d72db3d58581bcee6b3d02c0352b
This commit is contained in:
MORITA Kazutaka 2014-06-11 12:56:57 +09:00
parent 1f87522631
commit 32d8f7fbe8
3 changed files with 11 additions and 6 deletions

View File

@ -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):

View File

@ -3,3 +3,4 @@ sphinx
nose
openstack.nose_plugin
coverage
pylint

View File

@ -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