Style cleanup (avoid 1 char variable name, use is not none).
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/711ca5a3 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/711ca5a3 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/711ca5a3 Branch: refs/heads/trunk Commit: 711ca5a3f6c4116037e9d47c0d83aab66ef5150c Parents: cf32adf Author: Tomaz Muraus <[email protected]> Authored: Fri Jun 14 22:29:19 2013 -0700 Committer: Tomaz Muraus <[email protected]> Committed: Fri Jun 14 22:29:19 2013 -0700 ---------------------------------------------------------------------- libcloud/common/base.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/711ca5a3/libcloud/common/base.py ---------------------------------------------------------------------- diff --git a/libcloud/common/base.py b/libcloud/common/base.py index edbda17..b881c1a 100644 --- a/libcloud/common/base.py +++ b/libcloud/common/base.py @@ -544,31 +544,35 @@ class Connection(object): """ if params is None: params = {} + if headers is None: headers = {} action = self.morph_action_hook(action) self.action = action self.method = method + # Extend default parameters params = self.add_default_params(params) + # Extend default headers headers = self.add_default_headers(headers) + # We always send a user-agent header headers.update({'User-Agent': self._user_agent()}) - # Indicate that support gzip and deflate compression + # Indicate that we support gzip and deflate compression headers.update({'Accept-Encoding': 'gzip,deflate'}) - p = int(self.port) + port = int(self.port) - if p not in (80, 443): - headers.update({'Host': "%s:%d" % (self.host, p)}) + if port not in (80, 443): + headers.update({'Host': "%s:%d" % (self.host, port)}) else: headers.update({'Host': self.host}) # Encode data if necessary - if data != '' and data != None: + if data != '' and data is not None: data = self.encode_data(data) if data is not None:
