You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2011/02/03 03:42:41 UTC

svn commit: r1066725 - /qpid/trunk/qpid/tools/src/py/qmf-tool

Author: tross
Date: Thu Feb  3 02:42:40 2011
New Revision: 1066725

URL: http://svn.apache.org/viewvc?rev=1066725&view=rev
Log:
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.

Modified:
    qpid/trunk/qpid/tools/src/py/qmf-tool

Modified: qpid/trunk/qpid/tools/src/py/qmf-tool
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/py/qmf-tool?rev=1066725&r1=1066724&r2=1066725&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/py/qmf-tool (original)
+++ qpid/trunk/qpid/tools/src/py/qmf-tool Thu Feb  3 02:42:40 2011
@@ -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)



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org