comparison frontends/src/jp/cmd_debug.py @ 2068:741db5abf077

jp (debug/bridge/method,signal): fixed argument parsing
author Goffi <goffi@goffi.org>
date Sat, 10 Sep 2016 11:43:32 +0200
parents a3c2866841f7
children 8b37a62336c3
comparison
equal deleted inserted replaced
2067:7834743705f0 2068:741db5abf077
29 class BridgeCommon(object): 29 class BridgeCommon(object):
30 30
31 def evalArgs(self): 31 def evalArgs(self):
32 if self.args.arg: 32 if self.args.arg:
33 try: 33 try:
34 return eval(u",".join(self.args.arg)) 34 return eval(u'[{}]'.format(u",".join(self.args.arg)))
35 except SyntaxError as e: 35 except SyntaxError as e:
36 self.disp(u"Can't evaluate arguments: {mess}\n{text}\n{offset}^".format( 36 self.disp(u"Can't evaluate arguments: {mess}\n{text}\n{offset}^".format(
37 mess=e, 37 mess=e,
38 text=e.text.decode('utf-8'), 38 text=e.text.decode('utf-8'),
39 offset=u" "*(e.offset-1) 39 offset=u" "*(e.offset-1)
65 65
66 def start(self): 66 def start(self):
67 method = getattr(self.host.bridge, self.args.method) 67 method = getattr(self.host.bridge, self.args.method)
68 args = self.evalArgs() 68 args = self.evalArgs()
69 try: 69 try:
70 method(*self.args.arg, profile=self.profile, callback=self.method_cb, errback=self.method_eb) 70 method(*args, profile=self.profile, callback=self.method_cb, errback=self.method_eb)
71 except TypeError: 71 except TypeError:
72 # maybe the method doesn't need a profile ? 72 # maybe the method doesn't need a profile ?
73 try: 73 try:
74 method(*args, callback=self.method_cb, errback=self.method_eb) 74 method(*args, callback=self.method_cb, errback=self.method_eb)
75 except TypeError: 75 except TypeError: