Merge "Remove redundant default value None for dict.get"
This commit is contained in:
@@ -503,7 +503,7 @@ class AuthProtocol(object):
|
|||||||
cache = self._conf_get('cache')
|
cache = self._conf_get('cache')
|
||||||
memcache_servers = self._conf_get('memcached_servers')
|
memcache_servers = self._conf_get('memcached_servers')
|
||||||
|
|
||||||
if cache and env.get(cache, None) is not None:
|
if cache and env.get(cache) is not None:
|
||||||
# use the cache from the upstream filter
|
# use the cache from the upstream filter
|
||||||
self.LOG.info('Using %s memcache for caching token', cache)
|
self.LOG.info('Using %s memcache for caching token', cache)
|
||||||
self._cache = env.get(cache)
|
self._cache = env.get(cache)
|
||||||
|
@@ -64,7 +64,7 @@ def env(*vars, **kwargs):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
for v in vars:
|
for v in vars:
|
||||||
value = os.environ.get(v, None)
|
value = os.environ.get(v)
|
||||||
if value:
|
if value:
|
||||||
return value
|
return value
|
||||||
return kwargs.get('default', '')
|
return kwargs.get('default', '')
|
||||||
|
@@ -158,7 +158,7 @@ class TimezoneFixture(fixtures.Fixture):
|
|||||||
def __init__(self, new_tz):
|
def __init__(self, new_tz):
|
||||||
super(TimezoneFixture, self).__init__()
|
super(TimezoneFixture, self).__init__()
|
||||||
self.tz = new_tz
|
self.tz = new_tz
|
||||||
self.old_tz = os.environ.get('TZ', None)
|
self.old_tz = os.environ.get('TZ')
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TimezoneFixture, self).setUp()
|
super(TimezoneFixture, self).setUp()
|
||||||
|
@@ -134,7 +134,7 @@ class TestResponse(requests.Response):
|
|||||||
self.headers.update(headers)
|
self.headers.update(headers)
|
||||||
# Fake the text attribute to streamline Response creation
|
# Fake the text attribute to streamline Response creation
|
||||||
# _content is defined by requests.Response
|
# _content is defined by requests.Response
|
||||||
self._content = data.get('text', None)
|
self._content = data.get('text')
|
||||||
else:
|
else:
|
||||||
self.status_code = data
|
self.status_code = data
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ class FakeHTTPClient(fakes.FakeClient):
|
|||||||
(method, url, callback))
|
(method, url, callback))
|
||||||
|
|
||||||
# Note the call
|
# Note the call
|
||||||
self.callstack.append((method, url, kwargs.get('body', None)))
|
self.callstack.append((method, url, kwargs.get('body')))
|
||||||
|
|
||||||
if not hasattr(self, callback):
|
if not hasattr(self, callback):
|
||||||
raise AssertionError('Called unknown API method: %s %s, '
|
raise AssertionError('Called unknown API method: %s %s, '
|
||||||
@@ -56,7 +56,7 @@ class FakeHTTPClient(fakes.FakeClient):
|
|||||||
(method, url, callback))
|
(method, url, callback))
|
||||||
|
|
||||||
# Note the call
|
# Note the call
|
||||||
self.callstack.append((method, url, kwargs.get('body', None)))
|
self.callstack.append((method, url, kwargs.get('body')))
|
||||||
|
|
||||||
status, body = getattr(self, callback)(**kwargs)
|
status, body = getattr(self, callback)(**kwargs)
|
||||||
r = utils.TestResponse({
|
r = utils.TestResponse({
|
||||||
|
@@ -27,7 +27,7 @@ class Token(base.Resource):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def tenant(self):
|
def tenant(self):
|
||||||
return self._info['token'].get('tenant', None)
|
return self._info['token'].get('tenant')
|
||||||
|
|
||||||
|
|
||||||
class TokenManager(base.Manager):
|
class TokenManager(base.Manager):
|
||||||
|
Reference in New Issue
Block a user