Skip to content

Instantly share code, notes, and snippets.

@clayg
Created February 26, 2016 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clayg/e7fd810ed043319cbcae to your computer and use it in GitHub Desktop.
Save clayg/e7fd810ed043319cbcae to your computer and use it in GitHub Desktop.
$nosetests swift/test/probe/test_object_expirer.py:TestObjectExpirer.test_expirer_object_split_brain -vsx
...
======================================================================
ERROR: test_expirer_object_split_brain (test.probe.test_object_expirer.TestObjectExpirer)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vagrant/swift/test/probe/test_object_expirer.py", line 62, in test_expirer_object_split_brain
self.brain.put_object(headers={'X-Delete-After': 2})
File "/home/vagrant/swift/test/probe/brain.py", line 167, in put_object
self.object_name, headers=headers)
File "/vagrant/python-swiftclient/swiftclient/client.py", line 1271, in put_object
{'headers': headers}, resp, body)
File "/vagrant/python-swiftclient/swiftclient/client.py", line 153, in http_log
headers = scrub_headers(kwargs['headers'])
File "/vagrant/python-swiftclient/swiftclient/client.py", line 130, in scrub_headers
for (key, val) in headers
File "/vagrant/python-swiftclient/swiftclient/client.py", line 179, in parse_header_string
unquoted = unquote(data).decode('utf8')
File "/usr/lib/python2.7/urllib.py", line 1223, in unquote
bits = s.split('%')
AttributeError: 'int' object has no attribute 'split'
-------------------- >> begin captured logging << --------------------
diff --git a/swiftclient/client.py b/swiftclient/client.py
index 8375fed..125dbeb 100644
--- a/swiftclient/client.py
+++ b/swiftclient/client.py
@@ -169,6 +169,8 @@ def http_log(args, kwargs, resp, body):
def parse_header_string(data):
+ if not isinstance(data, six.text_type):
+ data = str(data)
if six.PY2:
if isinstance(data, six.text_type):
# Under Python2 requests only returns binary_type, but if we get
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment