Merge "Removes the use of mutables as default args"

This commit is contained in:
Jenkins 2016-06-20 13:40:28 +00:00 committed by Gerrit Code Review
commit 9ee6b81cd1
3 changed files with 8 additions and 4 deletions

View File

@ -31,7 +31,8 @@ class AuthTokenMiddleware(auth_token.AuthProtocol):
for public routes in the API.
"""
def __init__(self, app, conf, public_api_routes=[]):
def __init__(self, app, conf, public_api_routes=None):
api_routes = [] if public_api_routes is None else public_api_routes
self._ironic_app = app
# TODO(mrda): Remove .xml and ensure that doesn't result in a
# 401 Authentication Required instead of 404 Not Found
@ -39,7 +40,7 @@ class AuthTokenMiddleware(auth_token.AuthProtocol):
try:
self.public_api_routes = [re.compile(route_pattern_tpl % route_tpl)
for route_tpl in public_api_routes]
for route_tpl in api_routes]
except re.error as e:
msg = _('Cannot compile public API routes: %s') % e

View File

@ -116,7 +116,8 @@ class RPCService(service.Service):
signal.signal(signal.SIGUSR1, self._handle_signal)
def prepare_service(argv=[]):
def prepare_service(argv=None):
argv = [] if argv is None else argv
log.register_options(CONF)
log.set_defaults(default_log_levels=['amqp=WARNING',
'amqplib=WARNING',

View File

@ -37,7 +37,9 @@ class TestACL(base.BaseApiTest):
self.fake_db_node = db_utils.get_test_node(chassis_id=None)
self.node_path = '/nodes/%s' % self.fake_db_node['uuid']
def get_json(self, path, expect_errors=False, headers=None, q=[], **param):
def get_json(self, path, expect_errors=False, headers=None, q=None,
**param):
q = [] if q is None else q
return super(TestACL, self).get_json(path,
expect_errors=expect_errors,
headers=headers,