summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2011-03-02 16:31:26 +0000
committerGordon Sim <gsim@apache.org>2011-03-02 16:31:26 +0000
commit872b548667e23d49a8ffacfd272a38f44a19321c (patch)
treef064642ffd467669dcba7bad9cfbbdacfda371c5
parent79509a546b3ec27ddfd877d04df86965222c5033 (diff)
downloadqpid-python-872b548667e23d49a8ffacfd272a38f44a19321c.tar.gz
QPID-3101: better handling of different argument types for qpid-tool
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1076282 13f79535-47bb-0310-9956-ffa450edef68
-rwxr-xr-xqpid/tools/src/py/qpid-tool19
1 files changed, 18 insertions, 1 deletions
diff --git a/qpid/tools/src/py/qpid-tool b/qpid/tools/src/py/qpid-tool
index d3b0aa4097..2a06dae6ac 100755
--- a/qpid/tools/src/py/qpid-tool
+++ b/qpid/tools/src/py/qpid-tool
@@ -259,7 +259,24 @@ class QmfData(Console):
return
displayId = long(tokens[0])
methodName = tokens[1]
- args = tokens[2:]
+ args = []
+ for arg in tokens[2:]:
+ ##
+ ## If the argument is a map, list, boolean, integer, or floating (one decimal point),
+ ## run it through the Python evaluator so it is converted to the correct type.
+ ##
+ ## TODO: use a regex for this instead of this convoluted logic,
+ ## or even consider passing all args through eval() [which would
+ ## be a minor change to the nterface as string args would then
+ ## always need to be quoted as strings within a map/list would
+ ## now]
+ if arg[0] == '{' or arg[0] == '[' or arg == "True" or arg == "False" or \
+ ((arg.count('.') < 2 and (arg.count('-') == 0 or \
+ (arg.count('-') == 1 and arg[0] == '-')) and \
+ arg.replace('.','').replace('-','').isdigit())):
+ args.append(eval(arg))
+ else:
+ args.append(arg)
obj = None
try: