PEP8 Updates

This commit is contained in:
gholt 2010-12-29 22:47:16 +00:00 committed by Tarmac
commit 61c87661ec
5 changed files with 13 additions and 7 deletions

View File

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

View File

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

View File

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