libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [05/14] git commit: Don't send Content-Length header if len(data) == 0 and default all data arguments to None.
Date Sat, 15 Jun 2013 06:28:15 GMT
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 <tomaz@tomaz.me>
Authored: Fri Jun 14 22:30:09 2013 -0700
Committer: Tomaz Muraus <tomaz@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


Mime
View raw message