diff --git a/swift/common/middleware/cname_lookup.py b/swift/common/middleware/cname_lookup.py index d0ba2727c6..be7071ba16 100644 --- a/swift/common/middleware/cname_lookup.py +++ b/swift/common/middleware/cname_lookup.py @@ -61,7 +61,7 @@ class CNAMELookupMiddleware(object): port = '' if ':' in given_domain: 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) a_domain = given_domain if not a_domain.endswith(self.storage_domain): diff --git a/swift/common/middleware/memcache.py b/swift/common/middleware/memcache.py index 0eabb0fb68..0ec1288fd5 100644 --- a/swift/common/middleware/memcache.py +++ b/swift/common/middleware/memcache.py @@ -35,6 +35,8 @@ class MemcacheMiddleware(object): def filter_factory(global_conf, **local_conf): conf = global_conf.copy() conf.update(local_conf) + def cache_filter(app): return MemcacheMiddleware(app, conf) + return cache_filter diff --git a/swift/common/wsgi.py b/swift/common/wsgi.py index a93c21aa8a..e8c512f2ee 100644 --- a/swift/common/wsgi.py +++ b/swift/common/wsgi.py @@ -56,14 +56,15 @@ def monkey_patch_mimetools(): mimetools.Message.parsetype = parsetype + def get_socket(conf, default_port=8080): """Bind socket to bind ip:port in conf :param conf: Configuration dict to read settings from :param default_port: port to use if not specified in conf - :returns : a socket object as returned from socket.listen or ssl.wrap_socket - if conf specifies cert_file + :returns : a socket object as returned from socket.listen or + ssl.wrap_socket if conf specifies cert_file """ bind_addr = (conf.get('bind_ip', '0.0.0.0'), int(conf.get('bind_port', default_port))) diff --git a/swift/obj/replicator.py b/swift/obj/replicator.py index ed77bf5a10..ef02b9f3ec 100644 --- a/swift/obj/replicator.py +++ b/swift/obj/replicator.py @@ -245,7 +245,7 @@ class ObjectReplicator(Daemon): except Timeout: self.logger.error(_("Killing long-running rsync: %s"), str(args)) proc.kill() - return 1 # failure response code + return 1 # failure response code total_time = time.time() - start_time for result in results.split('\n'): if result == '': diff --git a/swift/proxy/server.py b/swift/proxy/server.py index 322294ecaa..1cde24cfe6 100644 --- a/swift/proxy/server.py +++ b/swift/proxy/server.py @@ -96,9 +96,11 @@ def delay_denial(func): return func(*a, **kw) return wrapped + def get_account_memcache_key(account): return 'account/%s' % account + def get_container_memcache_key(account, container): return 'container/%s/%s' % (account, container) @@ -298,7 +300,8 @@ class Controller(object): :param additional_info: additional information to log """ 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'], 'device': node['device'], 'info': additional_info}) @@ -349,7 +352,7 @@ class Controller(object): if result_code == 200: return partition, nodes elif result_code == 404: - return None, None + return None, None result_code = 0 attempts_left = self.app.account_ring.replica_count path = '/%s' % account @@ -1618,7 +1621,7 @@ class BaseApplication(object): self.account_ring = account_ring or \ Ring(os.path.join(swift_dir, 'account.ring.gz')) self.memcache = memcache - mimetypes.init(mimetypes.knownfiles + + mimetypes.init(mimetypes.knownfiles + [os.path.join(swift_dir, 'mime.types')]) def get_controller(self, path):