Do not use redundant attr check for keys in fold_headers
We only care about items, so use it, and pass if we get an AttributeError Change-Id: I7a09b63db390431be044ae3fc6aeece565606b40 Closes-Bug: #1756157
This commit is contained in:
parent
4b87196837
commit
e93d35f10d
|
@ -117,8 +117,10 @@ def fold_headers(headers):
|
|||
"""Turn a list of headers into a folded dict."""
|
||||
# If it behaves like a dict, return it. Webob uses objects which
|
||||
# are not dicts, but behave like them.
|
||||
if hasattr(headers, 'keys'):
|
||||
try:
|
||||
return dict((k.lower(), v) for k, v in headers.items())
|
||||
except AttributeError:
|
||||
pass
|
||||
header_dict = collections.defaultdict(list)
|
||||
for header, value in headers:
|
||||
header_dict[header.lower()].append(value.strip())
|
||||
|
|
Loading…
Reference in New Issue