summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2011-02-03 02:42:40 +0000
committerTed Ross <tross@apache.org>2011-02-03 02:42:40 +0000
commiteaeee8d856543dff3f1ac5a7d3eb95c42b8bbcf8 (patch)
tree29168555d377c23f008ce87ecf909d60626ce03c /tools
parent2a0ce0b675114f8a0ac501e488433823ac57f418 (diff)
downloadqpid-python-eaeee8d856543dff3f1ac5a7d3eb95c42b8bbcf8.tar.gz
Add detection of negative numbers to the method-argument evaluator.
Note: This logic is getting a bit hairy, it should be replaced with a regular expression match. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1066725 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tools')
-rwxr-xr-xtools/src/py/qmf-tool7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/src/py/qmf-tool b/tools/src/py/qmf-tool
index c01900ac62..3ea327b29a 100755
--- a/tools/src/py/qmf-tool
+++ b/tools/src/py/qmf-tool
@@ -310,8 +310,11 @@ class QmfData:
## 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.
##
- if arg[0] == '{' or arg[0] == '[' or arg == "True" or arg == "False" \
- or (arg.count('.') < 2 and arg.replace('.','').isdigit()):
+ ## TODO: use a regex for this instead of this convoluted logic
+ 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)