diff options
author | Kim van der Riet <kpvdr@apache.org> | 2011-07-08 13:02:10 +0000 |
---|---|---|
committer | Kim van der Riet <kpvdr@apache.org> | 2011-07-08 13:02:10 +0000 |
commit | 22f9df68228e36e098d114f9cd71626dd0ae2163 (patch) | |
tree | 1aae463a8fbb1f21dbb20ef1afdc61a50f1275c6 | |
parent | 6f22c386443b868d9d166660bace4a223f9705a2 (diff) | |
download | qpid-python-22f9df68228e36e098d114f9cd71626dd0ae2163.tar.gz |
QPID-3348: A fix whcih allows Qmf management calls defined in management-schema.xml to use keword arguments when being called from Python.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1144302 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | extras/qmf/src/py/qmf/console.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/extras/qmf/src/py/qmf/console.py b/extras/qmf/src/py/qmf/console.py index ecb0e1d9d0..291b9bcc5f 100644 --- a/extras/qmf/src/py/qmf/console.py +++ b/extras/qmf/src/py/qmf/console.py @@ -359,8 +359,8 @@ class Object(object): for arg in method.arguments: if arg.dir.find("I") != -1: count += 1 - if count != len(args): - raise Exception("Incorrect number of arguments: expected %d, got %d" % (count, len(args))) + if count != len(args) + len(kwargs): + raise Exception("Incorrect number of arguments: expected %d, got %d" % (count, len(args) + len(kwargs))) if self._agent.isV2: # @@ -372,7 +372,10 @@ class Object(object): argMap = {} for arg in method.arguments: if arg.dir.find("I") != -1: - argMap[arg.name] = args[aIdx] + if aIdx < len(args): + argMap[arg.name] = args[aIdx] + else: + argMap[arg.name] = kwargs[arg.name] aIdx += 1 call['_arguments'] = argMap @@ -439,6 +442,10 @@ class Object(object): else: sync = True + # Remove special "meta" kwargs before handing to _sendMethodRequest() to process + if "_timeout" in kwargs: del kwargs["_timeout"] + if "_async" in kwargs: del kwargs["_async"] + seq = self._sendMethodRequest(name, args, kwargs, sync, timeout) if seq: if not sync: |