PEP8 Updates
This commit is contained in:
commit
61c87661ec
@ -61,7 +61,7 @@ class CNAMELookupMiddleware(object):
|
|||||||
port = ''
|
port = ''
|
||||||
if ':' in given_domain:
|
if ':' in given_domain:
|
||||||
given_domain, port = given_domain.rsplit(':', 1)
|
given_domain, port = given_domain.rsplit(':', 1)
|
||||||
if given_domain == self.storage_domain[1:]: # strip initial '.'
|
if given_domain == self.storage_domain[1:]: # strip initial '.'
|
||||||
return self.app(env, start_response)
|
return self.app(env, start_response)
|
||||||
a_domain = given_domain
|
a_domain = given_domain
|
||||||
if not a_domain.endswith(self.storage_domain):
|
if not a_domain.endswith(self.storage_domain):
|
||||||
|
@ -35,6 +35,8 @@ class MemcacheMiddleware(object):
|
|||||||
def filter_factory(global_conf, **local_conf):
|
def filter_factory(global_conf, **local_conf):
|
||||||
conf = global_conf.copy()
|
conf = global_conf.copy()
|
||||||
conf.update(local_conf)
|
conf.update(local_conf)
|
||||||
|
|
||||||
def cache_filter(app):
|
def cache_filter(app):
|
||||||
return MemcacheMiddleware(app, conf)
|
return MemcacheMiddleware(app, conf)
|
||||||
|
|
||||||
return cache_filter
|
return cache_filter
|
||||||
|
@ -56,14 +56,15 @@ def monkey_patch_mimetools():
|
|||||||
|
|
||||||
mimetools.Message.parsetype = parsetype
|
mimetools.Message.parsetype = parsetype
|
||||||
|
|
||||||
|
|
||||||
def get_socket(conf, default_port=8080):
|
def get_socket(conf, default_port=8080):
|
||||||
"""Bind socket to bind ip:port in conf
|
"""Bind socket to bind ip:port in conf
|
||||||
|
|
||||||
:param conf: Configuration dict to read settings from
|
:param conf: Configuration dict to read settings from
|
||||||
:param default_port: port to use if not specified in conf
|
:param default_port: port to use if not specified in conf
|
||||||
|
|
||||||
:returns : a socket object as returned from socket.listen or ssl.wrap_socket
|
:returns : a socket object as returned from socket.listen or
|
||||||
if conf specifies cert_file
|
ssl.wrap_socket if conf specifies cert_file
|
||||||
"""
|
"""
|
||||||
bind_addr = (conf.get('bind_ip', '0.0.0.0'),
|
bind_addr = (conf.get('bind_ip', '0.0.0.0'),
|
||||||
int(conf.get('bind_port', default_port)))
|
int(conf.get('bind_port', default_port)))
|
||||||
|
@ -245,7 +245,7 @@ class ObjectReplicator(Daemon):
|
|||||||
except Timeout:
|
except Timeout:
|
||||||
self.logger.error(_("Killing long-running rsync: %s"), str(args))
|
self.logger.error(_("Killing long-running rsync: %s"), str(args))
|
||||||
proc.kill()
|
proc.kill()
|
||||||
return 1 # failure response code
|
return 1 # failure response code
|
||||||
total_time = time.time() - start_time
|
total_time = time.time() - start_time
|
||||||
for result in results.split('\n'):
|
for result in results.split('\n'):
|
||||||
if result == '':
|
if result == '':
|
||||||
|
@ -96,9 +96,11 @@ def delay_denial(func):
|
|||||||
return func(*a, **kw)
|
return func(*a, **kw)
|
||||||
return wrapped
|
return wrapped
|
||||||
|
|
||||||
|
|
||||||
def get_account_memcache_key(account):
|
def get_account_memcache_key(account):
|
||||||
return 'account/%s' % account
|
return 'account/%s' % account
|
||||||
|
|
||||||
|
|
||||||
def get_container_memcache_key(account, container):
|
def get_container_memcache_key(account, container):
|
||||||
return 'container/%s/%s' % (account, container)
|
return 'container/%s/%s' % (account, container)
|
||||||
|
|
||||||
@ -298,7 +300,8 @@ class Controller(object):
|
|||||||
:param additional_info: additional information to log
|
:param additional_info: additional information to log
|
||||||
"""
|
"""
|
||||||
self.app.logger.exception(
|
self.app.logger.exception(
|
||||||
_('ERROR with %(type)s server %(ip)s:%(port)s/%(device)s re: %(info)s'),
|
_('ERROR with %(type)s server %(ip)s:%(port)s/%(device)s re: '
|
||||||
|
'%(info)s'),
|
||||||
{'type': typ, 'ip': node['ip'], 'port': node['port'],
|
{'type': typ, 'ip': node['ip'], 'port': node['port'],
|
||||||
'device': node['device'], 'info': additional_info})
|
'device': node['device'], 'info': additional_info})
|
||||||
|
|
||||||
@ -349,7 +352,7 @@ class Controller(object):
|
|||||||
if result_code == 200:
|
if result_code == 200:
|
||||||
return partition, nodes
|
return partition, nodes
|
||||||
elif result_code == 404:
|
elif result_code == 404:
|
||||||
return None, None
|
return None, None
|
||||||
result_code = 0
|
result_code = 0
|
||||||
attempts_left = self.app.account_ring.replica_count
|
attempts_left = self.app.account_ring.replica_count
|
||||||
path = '/%s' % account
|
path = '/%s' % account
|
||||||
|
Loading…
Reference in New Issue
Block a user