Fix error log of proxy-server when cache middleware is disabled
Change-Id: I0b67721cbb692fb8d2a5dd8b2c4f5383512b7b45 Closes-Bug: #1306591
This commit is contained in:
parent
e0108af54f
commit
07841b4282
@ -1535,7 +1535,7 @@ def unlink_older_than(path, mtime):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def item_from_env(env, item_name):
|
def item_from_env(env, item_name, allow_none=False):
|
||||||
"""
|
"""
|
||||||
Get a value from the wsgi environment
|
Get a value from the wsgi environment
|
||||||
|
|
||||||
@ -1545,12 +1545,12 @@ def item_from_env(env, item_name):
|
|||||||
:returns: the value from the environment
|
:returns: the value from the environment
|
||||||
"""
|
"""
|
||||||
item = env.get(item_name, None)
|
item = env.get(item_name, None)
|
||||||
if item is None:
|
if item is None and not allow_none:
|
||||||
logging.error("ERROR: %s could not be found in env!" % item_name)
|
logging.error("ERROR: %s could not be found in env!" % item_name)
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
|
||||||
def cache_from_env(env):
|
def cache_from_env(env, allow_none=False):
|
||||||
"""
|
"""
|
||||||
Get memcache connection pool from the environment (which had been
|
Get memcache connection pool from the environment (which had been
|
||||||
previously set by the memcache middleware
|
previously set by the memcache middleware
|
||||||
@ -1559,7 +1559,7 @@ def cache_from_env(env):
|
|||||||
|
|
||||||
:returns: swift.common.memcached.MemcacheRing from environment
|
:returns: swift.common.memcached.MemcacheRing from environment
|
||||||
"""
|
"""
|
||||||
return item_from_env(env, 'swift.cache')
|
return item_from_env(env, 'swift.cache', allow_none)
|
||||||
|
|
||||||
|
|
||||||
def read_conf_dir(parser, conf_dir):
|
def read_conf_dir(parser, conf_dir):
|
||||||
|
@ -255,7 +255,7 @@ class Application(object):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
if self.memcache is None:
|
if self.memcache is None:
|
||||||
self.memcache = cache_from_env(env)
|
self.memcache = cache_from_env(env, True)
|
||||||
req = self.update_request(Request(env))
|
req = self.update_request(Request(env))
|
||||||
return self.handle_request(req)(env, start_response)
|
return self.handle_request(req)(env, start_response)
|
||||||
except UnicodeError:
|
except UnicodeError:
|
||||||
|
Loading…
Reference in New Issue
Block a user