Change default values from [] to None

Its well known fact that python default values initialized only once
at the stage if creation function. So if we call function with parameter 
foo=[] as default value and change foo.append("bar") at the next call of 
the function default value would be ["bar"]. It will save.

Change-Id: Iba9e55bc2d4dfd811ce7d068b6a9cceae7c000d6
This commit is contained in:
Roman Vasilets
2015-06-25 18:26:43 +03:00
parent 7e4d2edc97
commit 0b1be90970
2 changed files with 6 additions and 2 deletions

View File

@@ -18,8 +18,9 @@ import six
from ceilometerclient.common import base
def _get_opt_path(simple_params=[], **kwargs):
def _get_opt_path(simple_params=None, **kwargs):
l = []
simple_params = simple_params or []
# get simple paramters
for key in simple_params:
val = kwargs.get(key)

View File

@@ -44,7 +44,10 @@ class StatisticsManager(base.Manager):
)
return url_aggregates
def list(self, meter_name, q=None, period=None, groupby=[], aggregates=[]):
def list(self, meter_name, q=None, period=None, groupby=None,
aggregates=None):
groupby = groupby or []
aggregates = aggregates or []
p = ['period=%s' % period] if period else []
if isinstance(groupby, six.string_types):
groupby = [groupby]