From c2af0a135d7cf31531e5122ae52a60dbfa9955b2 Mon Sep 17 00:00:00 2001 From: Seth House Date: Wed, 24 Oct 2012 17:25:38 -0600 Subject: [PATCH] Switched getargspec return data from indexes to namedtuple notation --- salt/utils/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/salt/utils/__init__.py b/salt/utils/__init__.py index d122bb2ea0..4d1b6088c5 100644 --- a/salt/utils/__init__.py +++ b/salt/utils/__init__.py @@ -571,27 +571,27 @@ def format_call(fun, data): aspec = _getargs(fun) arglen = 0 deflen = 0 - if isinstance(aspec[0], list): - arglen = len(aspec[0]) - if isinstance(aspec[3], tuple): - deflen = len(aspec[3]) - if aspec[2]: + if isinstance(aspec.args, list): + arglen = len(aspec.args) + if isinstance(aspec.defaults, tuple): + deflen = len(aspec.defaults) + if aspec.keywords: # This state accepts kwargs ret['kwargs'] = {} for key in data: # Passing kwargs the conflict with args == stack trace - if key in aspec[0]: + if key in aspec.args: continue ret['kwargs'][key] = data[key] kwargs = {} for ind in range(arglen - 1, 0, -1): minus = arglen - ind if deflen - minus > -1: - kwargs[aspec[0][ind]] = aspec[3][-minus] + kwargs[aspec.args[ind]] = aspec.defaults[-minus] for arg in kwargs: if arg in data: kwargs[arg] = data[arg] - for arg in aspec[0]: + for arg in aspec.args: if arg in kwargs: ret['args'].append(kwargs[arg]) else: