You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by pq...@apache.org on 2010/01/08 00:58:26 UTC
svn commit: r897059 - /incubator/libcloud/trunk/libcloud/base.py
Author: pquerna
Date: Thu Jan 7 23:58:21 2010
New Revision: 897059
URL: http://svn.apache.org/viewvc?rev=897059&view=rev
Log:
Don't use default dicts if no keyword arg is supplied, because these {} are the same objects, and over multiple calls they would accumulate random headers and params
Modified:
incubator/libcloud/trunk/libcloud/base.py
Modified: incubator/libcloud/trunk/libcloud/base.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/base.py?rev=897059&r1=897058&r2=897059&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/base.py (original)
+++ incubator/libcloud/trunk/libcloud/base.py Thu Jan 7 23:58:21 2010
@@ -305,7 +305,7 @@
connection = self.conn_classes[self.secure](host, port)
self.connection = connection
- def request(self, action, params={}, data='', headers={}, method='GET'):
+ def request(self, action, params=None, data='', headers=None, method='GET'):
"""
Request a given `action`.
@@ -331,6 +331,10 @@
@return: An instance of type I{responseCls}
"""
+ if params is None:
+ params = {}
+ if headers is None:
+ headers = {}
# Extend default parameters
params = self.add_default_params(params)
# Extend default headers