You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/06/15 08:28:11 UTC
[01/14] git commit: Decouple Connection from the driver and don't
require 'driver' attribute to be set.
Updated Branches:
refs/heads/0.12.x 742d0832f -> 3e77f66bf
refs/heads/trunk fe998bf6a -> 58ab7ae0b
Decouple Connection from the driver and don't require 'driver' attribute to be
set.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/873c1ee5
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/873c1ee5
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/873c1ee5
Branch: refs/heads/trunk
Commit: 873c1ee5993d7fdd4894685677187dc77b09a840
Parents: fe998bf
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Fri Jun 14 22:13:40 2013 -0700
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Fri Jun 14 22:13:40 2013 -0700
----------------------------------------------------------------------
libcloud/common/base.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/873c1ee5/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index c8eca27..4347e5e 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -485,10 +485,17 @@ class Connection(object):
self.connection = connection
def _user_agent(self):
- return 'libcloud/%s (%s)%s' % (
+ user_agent_suffix = ' '.join(['(%s)' % x for x in self.ua])
+
+ if self.driver:
+ user_agent = 'libcloud/%s (%s) %s' % (
libcloud.__version__,
- self.driver.name,
- "".join([" (%s)" % x for x in self.ua]))
+ self.driver.name, user_agent_suffix)
+ else:
+ user_agent = 'libcloud/%s %s' % (
+ libcloud.__version__, user_agent_suffix)
+
+ return user_agent
def user_agent_append(self, token):
"""
[13/14] git commit: Update affected test and mockhttp class.
Posted by to...@apache.org.
Update affected test and mockhttp class.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9bf618c4
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9bf618c4
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9bf618c4
Branch: refs/heads/0.12.x
Commit: 9bf618c4b79379cc584f8d293974eefda3939741
Parents: fd76cf6
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Fri Jun 14 23:05:47 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jun 14 23:22:17 2013 -0700
----------------------------------------------------------------------
libcloud/test/__init__.py | 4 ++--
libcloud/test/compute/test_brightbox.py | 9 ++++++---
2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9bf618c4/libcloud/test/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/test/__init__.py b/libcloud/test/__init__.py
index c6c8dff..20c8a75 100644
--- a/libcloud/test/__init__.py
+++ b/libcloud/test/__init__.py
@@ -77,9 +77,9 @@ class MockResponse(object):
reason = ''
version = 11
- def __init__(self, status, body, headers=None, reason=None):
+ def __init__(self, status, body=None, headers=None, reason=None):
self.status = status
- self.body = StringIO(u(body))
+ self.body = StringIO(u(body)) if body else StringIO()
self.headers = headers or self.headers
self.reason = reason or self.reason
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9bf618c4/libcloud/test/compute/test_brightbox.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_brightbox.py b/libcloud/test/compute/test_brightbox.py
index 95c0648..b9f3ce2 100644
--- a/libcloud/test/compute/test_brightbox.py
+++ b/libcloud/test/compute/test_brightbox.py
@@ -285,13 +285,16 @@ class BrightboxMockHttp(MockHttp):
return self.response(httplib.OK, self.fixtures.load('list_zones.json'))
def _2_0_zones(self, method, url, body, headers):
return self.response(httplib.BAD_REQUEST, '{"error_name":"unrecognised_endpoint", "errors": ["The request was for an unrecognised API endpoint"]}')
-
+
def _1_0_cloud_ips(self, method, url, body, headers):
if method == 'GET':
return self.response(httplib.OK, self.fixtures.load('list_cloud_ips.json'))
elif method == 'POST':
- body = json.loads(body)
+ if body:
+ body = json.loads(body)
+
node = json.loads(self.fixtures.load('create_cloud_ip.json'))
+
if 'reverse_dns' in body:
node['reverse_dns'] = body['reverse_dns']
return self.response(httplib.ACCEPTED, json.dumps(node))
@@ -305,7 +308,7 @@ class BrightboxMockHttp(MockHttp):
return self.response(httplib.OK, '')
else:
return self.response(httplib.BAD_REQUEST, '{"error_name":"bad dns", "errors": ["Bad dns"]}')
-
+
def _1_0_cloud_ips_cip_jsjc5_map(self, method, url, body, headers):
if method == 'POST':
body = json.loads(body)
[09/14] git commit: Modify Connection.request so it works correctly
if 'params' value is a sequence.
Posted by to...@apache.org.
Modify Connection.request so it works correctly if 'params' value is a sequence.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/fa1a5314
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/fa1a5314
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/fa1a5314
Branch: refs/heads/0.12.x
Commit: fa1a5314c5bb9c2fba4cdfa720cd7b68199d74d7
Parents: b463c62
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Fri Jun 14 22:16:02 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jun 14 23:21:52 2013 -0700
----------------------------------------------------------------------
libcloud/common/base.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/fa1a5314/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index a1a6c42..a5d2a49 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -603,9 +603,9 @@ class Connection(object):
if params:
if '?' in action:
- url = '&'.join((action, urlencode(params)))
+ url = '&'.join((action, urlencode(params, doseq=True)))
else:
- url = '?'.join((action, urlencode(params)))
+ url = '?'.join((action, urlencode(params, doseq=True)))
else:
url = action
[04/14] git commit: Style cleanup (avoid 1 char variable name,
use is not none).
Posted by to...@apache.org.
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 <to...@tomaz.me>
Authored: Fri Jun 14 22:29:19 2013 -0700
Committer: Tomaz Muraus <to...@tomaz.me>
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:
[02/14] git commit: Modify Connection.request so it works correctly
if 'params' value is a sequence.
Posted by to...@apache.org.
Modify Connection.request so it works correctly if 'params' value is a sequence.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/8c4217a4
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/8c4217a4
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/8c4217a4
Branch: refs/heads/trunk
Commit: 8c4217a416025220e0a4839bdd79079822c71a74
Parents: 873c1ee
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Fri Jun 14 22:16:02 2013 -0700
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Fri Jun 14 22:16:02 2013 -0700
----------------------------------------------------------------------
libcloud/common/base.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8c4217a4/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index 4347e5e..7b8cf0d 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -583,9 +583,9 @@ class Connection(object):
if params:
if '?' in action:
- url = '&'.join((action, urlencode(params)))
+ url = '&'.join((action, urlencode(params, doseq=True)))
else:
- url = '?'.join((action, urlencode(params)))
+ url = '?'.join((action, urlencode(params, doseq=True)))
else:
url = action
[10/14] git commit: Default data to None.
Posted by to...@apache.org.
Default data to None.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e94106f3
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e94106f3
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e94106f3
Branch: refs/heads/0.12.x
Commit: e94106f3b3d3d33cc403f5c0ee9cf0dadf697143
Parents: fa1a531
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Fri Jun 14 22:28:37 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jun 14 23:21:57 2013 -0700
----------------------------------------------------------------------
libcloud/common/base.py | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e94106f3/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index a5d2a49..ae0f732 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -529,13 +529,8 @@ class Connection(object):
"""
self.ua.append(token)
- def request(self,
- action,
- params=None,
- data='',
- headers=None,
- method='GET',
- raw=False):
+ def request(self, action, params=None, data=None, headers=None,
+ method='GET', raw=False):
"""
Request a given `action`.
[08/14] git commit: Decouple Connection from the driver and don't
require 'driver' attribute to be set.
Posted by to...@apache.org.
Decouple Connection from the driver and don't require 'driver' attribute to be
set.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b463c628
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b463c628
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b463c628
Branch: refs/heads/0.12.x
Commit: b463c62837d92a9e4974ea93003a9aecbedcfd02
Parents: 742d083
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Fri Jun 14 22:13:40 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jun 14 23:21:47 2013 -0700
----------------------------------------------------------------------
libcloud/common/base.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b463c628/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index c03a5ea..a1a6c42 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -505,10 +505,17 @@ class Connection(object):
self.connection = connection
def _user_agent(self):
- return 'libcloud/%s (%s)%s' % (
+ user_agent_suffix = ' '.join(['(%s)' % x for x in self.ua])
+
+ if self.driver:
+ user_agent = 'libcloud/%s (%s) %s' % (
libcloud.__version__,
- self.driver.name,
- "".join([" (%s)" % x for x in self.ua]))
+ self.driver.name, user_agent_suffix)
+ else:
+ user_agent = 'libcloud/%s %s' % (
+ libcloud.__version__, user_agent_suffix)
+
+ return user_agent
def user_agent_append(self, token):
"""
[03/14] git commit: Default data to None.
Posted by to...@apache.org.
Default data to None.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/cf32adf3
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/cf32adf3
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/cf32adf3
Branch: refs/heads/trunk
Commit: cf32adf36cc48e2f51c3b9466a57e6c2280ec374
Parents: 8c4217a
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Fri Jun 14 22:28:37 2013 -0700
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Fri Jun 14 22:28:37 2013 -0700
----------------------------------------------------------------------
libcloud/common/base.py | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/cf32adf3/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index 7b8cf0d..edbda17 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -509,13 +509,8 @@ class Connection(object):
"""
self.ua.append(token)
- def request(self,
- action,
- params=None,
- data='',
- headers=None,
- method='GET',
- raw=False):
+ def request(self, action, params=None, data=None, headers=None,
+ method='GET', raw=False):
"""
Request a given `action`.
[14/14] git commit: Update changes.
Posted by to...@apache.org.
Update changes.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3e77f66b
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3e77f66b
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3e77f66b
Branch: refs/heads/0.12.x
Commit: 3e77f66bf979c24fd8dd3f7c121096df455b24a3
Parents: 9bf618c
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Fri Jun 14 23:06:11 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jun 14 23:22:24 2013 -0700
----------------------------------------------------------------------
CHANGES | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3e77f66b/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 7b4f5a8..20795ed 100644
--- a/CHANGES
+++ b/CHANGES
@@ -18,6 +18,10 @@ Changes with Apache Libcloud in deveploment:
authenticate() call.
[Tomaz Muraus]
+ - Modify base Connection class to not send Content-Length header if body is
+ not provided.
+ [Tomaz Muraus]
+
*) Compute
- Fix destroy_node method in the experimental libvirt driver.
[06/14] git commit: Update affected test and mockhttp class.
Posted by to...@apache.org.
Update affected test and mockhttp class.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/cb18a091
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/cb18a091
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/cb18a091
Branch: refs/heads/trunk
Commit: cb18a091c05e38975e5faf565af09549cb5b7aea
Parents: 5e782bf
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Fri Jun 14 23:05:47 2013 -0700
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Fri Jun 14 23:05:47 2013 -0700
----------------------------------------------------------------------
libcloud/test/__init__.py | 4 ++--
libcloud/test/compute/test_brightbox.py | 9 ++++++---
2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/cb18a091/libcloud/test/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/test/__init__.py b/libcloud/test/__init__.py
index c6c8dff..20c8a75 100644
--- a/libcloud/test/__init__.py
+++ b/libcloud/test/__init__.py
@@ -77,9 +77,9 @@ class MockResponse(object):
reason = ''
version = 11
- def __init__(self, status, body, headers=None, reason=None):
+ def __init__(self, status, body=None, headers=None, reason=None):
self.status = status
- self.body = StringIO(u(body))
+ self.body = StringIO(u(body)) if body else StringIO()
self.headers = headers or self.headers
self.reason = reason or self.reason
http://git-wip-us.apache.org/repos/asf/libcloud/blob/cb18a091/libcloud/test/compute/test_brightbox.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_brightbox.py b/libcloud/test/compute/test_brightbox.py
index 95c0648..b9f3ce2 100644
--- a/libcloud/test/compute/test_brightbox.py
+++ b/libcloud/test/compute/test_brightbox.py
@@ -285,13 +285,16 @@ class BrightboxMockHttp(MockHttp):
return self.response(httplib.OK, self.fixtures.load('list_zones.json'))
def _2_0_zones(self, method, url, body, headers):
return self.response(httplib.BAD_REQUEST, '{"error_name":"unrecognised_endpoint", "errors": ["The request was for an unrecognised API endpoint"]}')
-
+
def _1_0_cloud_ips(self, method, url, body, headers):
if method == 'GET':
return self.response(httplib.OK, self.fixtures.load('list_cloud_ips.json'))
elif method == 'POST':
- body = json.loads(body)
+ if body:
+ body = json.loads(body)
+
node = json.loads(self.fixtures.load('create_cloud_ip.json'))
+
if 'reverse_dns' in body:
node['reverse_dns'] = body['reverse_dns']
return self.response(httplib.ACCEPTED, json.dumps(node))
@@ -305,7 +308,7 @@ class BrightboxMockHttp(MockHttp):
return self.response(httplib.OK, '')
else:
return self.response(httplib.BAD_REQUEST, '{"error_name":"bad dns", "errors": ["Bad dns"]}')
-
+
def _1_0_cloud_ips_cip_jsjc5_map(self, method, url, body, headers):
if method == 'POST':
body = json.loads(body)
[07/14] git commit: Update changes.
Posted by to...@apache.org.
Update changes.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/58ab7ae0
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/58ab7ae0
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/58ab7ae0
Branch: refs/heads/trunk
Commit: 58ab7ae0b236c613edbc2d9f2dda6e5128f48dbf
Parents: cb18a09
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Fri Jun 14 23:06:11 2013 -0700
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Fri Jun 14 23:06:11 2013 -0700
----------------------------------------------------------------------
CHANGES | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/58ab7ae0/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index cf3c8a3..d2c2d9d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -18,6 +18,10 @@ Changes with Apache Libcloud in deveploment:
authenticate() call.
[Tomaz Muraus]
+ - Modify base Connection class to not send Content-Length header if body is
+ not provided.
+ [Tomaz Muraus]
+
*) Compute
- Fix destroy_node method in the experimental libvirt driver.
[11/14] git commit: Style cleanup (avoid 1 char variable name,
use is not none).
Posted by to...@apache.org.
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 <to...@tomaz.me>
Authored: Fri Jun 14 22:29:19 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
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:
[05/14] git commit: Don't send Content-Length header if len(data) ==
0 and default all data arguments to None.
Posted by to...@apache.org.
Don't send Content-Length header if len(data) == 0 and default all data
arguments to None.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/5e782bf9
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/5e782bf9
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/5e782bf9
Branch: refs/heads/trunk
Commit: 5e782bf932ad39b0242dee42ef0d29f2a391d780
Parents: 711ca5a
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Fri Jun 14 22:30:09 2013 -0700
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Fri Jun 14 22:54:18 2013 -0700
----------------------------------------------------------------------
libcloud/common/base.py | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/5e782bf9/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index b881c1a..21eef2b 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -572,10 +572,8 @@ class Connection(object):
headers.update({'Host': self.host})
# Encode data if necessary
- if data != '' and data is not None:
+ if data:
data = self.encode_data(data)
-
- if data is not None:
headers.update({'Content-Length': str(len(data))})
params, headers = self.pre_connect_hook(params, headers)
@@ -672,7 +670,7 @@ class PollingConnection(Connection):
timeout = 200
request_method = 'request'
- def async_request(self, action, params=None, data='', headers=None,
+ def async_request(self, action, params=None, data=None, headers=None,
method='GET', context=None):
"""
Perform an 'async' request to the specified path. Keep in mind that
@@ -738,7 +736,7 @@ class PollingConnection(Connection):
return response
- def get_request_kwargs(self, action, params=None, data='', headers=None,
+ def get_request_kwargs(self, action, params=None, data=None, headers=None,
method='GET', context=None):
"""
Arguments which are passed to the initial request() call inside
[12/14] git commit: Don't send Content-Length header if len(data) ==
0 and default all data arguments to None.
Posted by to...@apache.org.
Don't send Content-Length header if len(data) == 0 and default all data
arguments to None.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/fd76cf64
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/fd76cf64
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/fd76cf64
Branch: refs/heads/0.12.x
Commit: fd76cf64c26fbbe865eb281699bbf6def2032ed2
Parents: e998c39
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Fri Jun 14 22:30:09 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jun 14 23:22:10 2013 -0700
----------------------------------------------------------------------
libcloud/common/base.py | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/fd76cf64/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index a2c6b15..464bec8 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -592,10 +592,8 @@ class Connection(object):
headers.update({'Host': self.host})
# Encode data if necessary
- if data != '' and data is not None:
+ if data:
data = self.encode_data(data)
-
- if data is not None:
headers.update({'Content-Length': str(len(data))})
params, headers = self.pre_connect_hook(params, headers)
@@ -692,7 +690,7 @@ class PollingConnection(Connection):
timeout = 200
request_method = 'request'
- def async_request(self, action, params=None, data='', headers=None,
+ def async_request(self, action, params=None, data=None, headers=None,
method='GET', context=None):
"""
Perform an 'async' request to the specified path. Keep in mind that
@@ -758,7 +756,7 @@ class PollingConnection(Connection):
return response
- def get_request_kwargs(self, action, params=None, data='', headers=None,
+ def get_request_kwargs(self, action, params=None, data=None, headers=None,
method='GET', context=None):
"""
Arguments which are passed to the initial request() call inside