summaryrefslogtreecommitdiff
path: root/tools/src/py/qpid-tool
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
commitc281f0b260c331f09f827641862d5b5df2a0dbe5 (patch)
tree903f2e74424a72eacf5e5ec686619f373c28950a /tools/src/py/qpid-tool
parentcd6506bd17c9284cff17b27e96afbd27356fa7aa (diff)
downloadqpid-python-c281f0b260c331f09f827641862d5b5df2a0dbe5.tar.gz
QPID-3101: better handling of different argument types for qpid-tool
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1076282 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tools/src/py/qpid-tool')
-rwxr-xr-xtools/src/py/qpid-tool19
1 files changed, 18 insertions, 1 deletions
diff --git a/tools/src/py/qpid-tool b/tools/src/py/qpid-tool
index d3b0aa4097..2a06dae6ac 100755
--- a/tools/src/py/qpid-tool
+++ b/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: