summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Taylor <kragniz@gmail.com>2014-08-26 18:21:47 +0000
committerLouis Taylor <kragniz@gmail.com>2014-08-26 18:23:23 +0000
commit6dda6f306f44f68c437176428eb041d4fd862505 (patch)
treea41d7ef2ab09d539a997736ae0479031153e73ee
parent6987295884f8eca57cb4e04796b91c9755b323e7 (diff)
downloadpython-glanceclient-6dda6f306f44f68c437176428eb041d4fd862505.tar.gz
Fix error when logging http response with python 3
Python 3 changed the semantics of dict.items() [0], which now returns a iterable 'view' instead of a list of tuples. This has the repercussion that you can no longer check for membership of a key using: key in dict.items() This patch simply replaces that check with a test for the key existing in the dict itself, rather than the items. [0] http://legacy.python.org/dev/peps/pep-3106/ Closes-Bug: 1359880 Change-Id: I7c59b0432725b660c9fa7270cde2e07bf3ea77db
-rw-r--r--glanceclient/common/http.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py
index d5fa1d3..4023f03 100644
--- a/glanceclient/common/http.py
+++ b/glanceclient/common/http.py
@@ -119,7 +119,7 @@ class HTTPClient(object):
status = (resp.raw.version / 10.0, resp.status_code, resp.reason)
dump = ['\nHTTP/%.1f %s %s' % status]
headers = resp.headers.items()
- if 'X-Auth-Token' in headers:
+ if 'X-Auth-Token' in resp.headers:
headers['X-Auth-Token'] = '*' * 3
dump.extend(['%s: %s' % (k, v) for k, v in headers])
dump.append('')