Author: kpvdr
Date: Fri Jul 8 13:02:10 2011
New Revision: 1144302
URL: http://svn.apache.org/viewvc?rev=1144302&view=rev
Log:
QPID-3348: A fix whcih allows Qmf management calls defined in
management-schema.xml to use keword arguments when being called from Python.
Modified:
qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py
Modified: qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py
URL:
http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py?rev=1144302&r1=1144301&r2=1144302&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py (original)
+++ qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py Fri Jul 8 13:02:10 2011
@@ -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:
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]