diff options
author | Alistair Coles <alistair.coles@hp.com> | 2014-10-15 18:56:58 +0100 |
---|---|---|
committer | Alistair Coles <alistair.coles@hp.com> | 2014-10-20 12:00:54 +0100 |
commit | 871a3e40f306f1bff056a86edcd644a82ab29c67 (patch) | |
tree | a7d9310bb000db7e24a11abffbdc14625b93f5ac /swiftclient/client.py | |
parent | bbe3378ebbdfd5b5aeae979965fa2ac9e165afb4 (diff) | |
download | python-swiftclient-871a3e40f306f1bff056a86edcd644a82ab29c67.tar.gz |
Fix KeyError raised from client Connection
Some client.Connection methods will raise a KeyError
if a response_dict argument is passed and an error
occurs during authentication or making the request.
The fix is straightforward: add a test for existence
of a response_dict before attempting to get it from
kwargs.
The bulk of this patch is adding unit tests for the
response_dict feature.
Closes-Bug: 1381304
Change-Id: Ic7e1b3dfae33909533931c52ac97355867a08a07
Diffstat (limited to 'swiftclient/client.py')
-rw-r--r-- | swiftclient/client.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/swiftclient/client.py b/swiftclient/client.py index def40bf..8372e63 100644 --- a/swiftclient/client.py +++ b/swiftclient/client.py @@ -1215,7 +1215,7 @@ class Connection(object): ssl_compression=self.ssl_compression) def _add_response_dict(self, target_dict, kwargs): - if target_dict is not None: + if target_dict is not None and 'response_dict' in kwargs: response_dict = kwargs['response_dict'] if 'response_dicts' in target_dict: target_dict['response_dicts'].append(response_dict) |