summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbhagyashris <bhagyashri.shewale@nttdata.com>2016-08-26 13:19:43 +0530
committerbhagyashris <bhagyashri.shewale@nttdata.com>2016-08-29 11:35:02 +0530
commit0504354233e2f856b8275036f1e58840aecf9a11 (patch)
tree64bed0913269ad202f40dd62b5b9ba8e05176f90
parent8db4ca1d90c714c49a88a05e9cc008b3bd9f2245 (diff)
downloadpython-cinderclient-0504354233e2f856b8275036f1e58840aecf9a11.tar.gz
Replace functions 'Dict.get' and 'del' with 'Dict.pop'
Refactoring code: Making dicts to use single instruction: pop() rather than two instructions: get() and del, giving the codes a format that carries through. TrivialFix Change-Id: Ie404888ccf257978e0ac491165926dfde9a3e6d6
-rw-r--r--cinderclient/client.py3
-rw-r--r--cinderclient/openstack/common/apiclient/client.py6
2 files changed, 2 insertions, 7 deletions
diff --git a/cinderclient/client.py b/cinderclient/client.py
index 0f95311..7d03563 100644
--- a/cinderclient/client.py
+++ b/cinderclient/client.py
@@ -307,8 +307,7 @@ class HTTPClient(object):
if 'body' in kwargs:
kwargs['headers']['Content-Type'] = 'application/json'
- kwargs['data'] = json.dumps(kwargs['body'])
- del kwargs['body']
+ kwargs['data'] = json.dumps(kwargs.pop('body'))
api_versions.update_headers(kwargs["headers"], self.api_version)
if self.timeout:
diff --git a/cinderclient/openstack/common/apiclient/client.py b/cinderclient/openstack/common/apiclient/client.py
index ec9c6d5..3741df9 100644
--- a/cinderclient/openstack/common/apiclient/client.py
+++ b/cinderclient/openstack/common/apiclient/client.py
@@ -144,11 +144,7 @@ class HTTPClient(object):
def serialize(self, kwargs):
if kwargs.get('json') is not None:
kwargs['headers']['Content-Type'] = 'application/json'
- kwargs['data'] = json.dumps(kwargs['json'])
- try:
- del kwargs['json']
- except KeyError:
- pass
+ kwargs['data'] = json.dumps(kwargs.pop('json'))
def get_timings(self):
return self.times