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/e998c39d Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e998c39d Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e998c39d Branch: refs/heads/0.12.x Commit: e998c39d814c680662a3058cfaf5a1b41cbf668e Parents: e94106f Author: Tomaz Muraus <[email protected]> Authored: Fri Jun 14 22:29:19 2013 -0700 Committer: Tomaz Muraus <[email protected]> Committed: Fri Jun 14 23:22:04 2013 -0700 ---------------------------------------------------------------------- libcloud/common/base.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/e998c39d/libcloud/common/base.py ---------------------------------------------------------------------- diff --git a/libcloud/common/base.py b/libcloud/common/base.py index ae0f732..a2c6b15 100644 --- a/libcloud/common/base.py +++ b/libcloud/common/base.py @@ -564,31 +564,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:
