Uses None instead of mutable dicts for default function arguments
Forgot to update dicts with changeset I4a89afad, which updated lists. Change-Id: Ieca71b9c90ee5dae83a43f6851b6b8b2924bcb8e Fixes: bug 1174809
This commit is contained in:
parent
7bf0db6b75
commit
d69fa437cd
@ -180,7 +180,10 @@ def direct_get_container(node, part, account, container, marker=None,
|
||||
|
||||
|
||||
def direct_delete_container(node, part, account, container, conn_timeout=5,
|
||||
response_timeout=15, headers={}):
|
||||
response_timeout=15, headers=None):
|
||||
if headers is None:
|
||||
headers = {}
|
||||
|
||||
path = '/%s/%s' % (account, container)
|
||||
headers['X-Timestamp'] = normalize_timestamp(time())
|
||||
with Timeout(conn_timeout):
|
||||
@ -237,7 +240,7 @@ def direct_head_object(node, part, account, container, obj, conn_timeout=5,
|
||||
|
||||
|
||||
def direct_get_object(node, part, account, container, obj, conn_timeout=5,
|
||||
response_timeout=15, resp_chunk_size=None, headers={}):
|
||||
response_timeout=15, resp_chunk_size=None, headers=None):
|
||||
"""
|
||||
Get object directly from the object server.
|
||||
|
||||
@ -253,6 +256,9 @@ def direct_get_object(node, part, account, container, obj, conn_timeout=5,
|
||||
:returns: a tuple of (response headers, the object's contents) The response
|
||||
headers will be a dict and all header names will be lowercase.
|
||||
"""
|
||||
if headers is None:
|
||||
headers = {}
|
||||
|
||||
path = '/%s/%s/%s' % (account, container, obj)
|
||||
with Timeout(conn_timeout):
|
||||
conn = http_connect(node['ip'], node['port'], node['device'], part,
|
||||
@ -378,7 +384,7 @@ def direct_post_object(node, part, account, container, name, headers,
|
||||
|
||||
|
||||
def direct_delete_object(node, part, account, container, obj,
|
||||
conn_timeout=5, response_timeout=15, headers={}):
|
||||
conn_timeout=5, response_timeout=15, headers=None):
|
||||
"""
|
||||
Delete object directly from the object server.
|
||||
|
||||
@ -391,6 +397,9 @@ def direct_delete_object(node, part, account, container, obj,
|
||||
:param response_timeout: timeout in seconds for getting the response
|
||||
:returns: response from server
|
||||
"""
|
||||
if headers is None:
|
||||
headers = {}
|
||||
|
||||
path = '/%s/%s/%s' % (account, container, obj)
|
||||
headers['X-Timestamp'] = normalize_timestamp(time())
|
||||
with Timeout(conn_timeout):
|
||||
|
@ -925,7 +925,7 @@ class Response(object):
|
||||
charset = _resp_charset_property()
|
||||
app_iter = _resp_app_iter_property()
|
||||
|
||||
def __init__(self, body=None, status=200, headers={}, app_iter=None,
|
||||
def __init__(self, body=None, status=200, headers=None, app_iter=None,
|
||||
request=None, conditional_response=False, **kw):
|
||||
self.headers = HeaderKeyDict(
|
||||
[('Content-Type', 'text/html; charset=UTF-8')])
|
||||
@ -939,7 +939,8 @@ class Response(object):
|
||||
self.environ = request.environ
|
||||
else:
|
||||
self.environ = {}
|
||||
self.headers.update(headers)
|
||||
if headers:
|
||||
self.headers.update(headers)
|
||||
for key, value in kw.iteritems():
|
||||
setattr(self, key, value)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user