summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-08-10 16:21:21 +0200
committerdavemds <dave@gurumeditation.it>2014-08-10 16:21:21 +0200
commit55746803aada1be941ea08bb2bc7b8248a97d2f6 (patch)
tree1ab3c2d386b0f9342c1ae3cb8d91f9db222fb65c
parent771f0616daf7cb5e2e71e2ad4bd11df00676d756 (diff)
Fix the method runner to not fail when more than one param given
Also use ast.literal_eval instead ov eval. It's more secure this way
-rw-r--r--espionage/espionage.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/espionage/espionage.py b/espionage/espionage.py
index 7203620..54577eb 100644
--- a/espionage/espionage.py
+++ b/espionage/espionage.py
@@ -22,6 +22,7 @@ import os
22import sys 22import sys
23import dbus 23import dbus
24import json 24import json
25import ast
25from xml.etree import ElementTree 26from xml.etree import ElementTree
26 27
27from efl import elementary as elm 28from efl import elementary as elm
@@ -666,12 +667,16 @@ class MethodRunner(StandardWindow):
666 # async method call 667 # async method call
667 try: 668 try:
668 if user_params: 669 if user_params:
669 meth(eval(user_params), 670 params = ast.literal_eval(user_params)
670 reply_handler = self.reply_handler, 671 if type(params) is tuple:
671 error_handler = self.error_handler) 672 meth(*params, reply_handler=self.reply_handler,
673 error_handler=self.error_handler)
674 else:
675 meth(params, reply_handler=self.reply_handler,
676 error_handler=self.error_handler)
672 else: 677 else:
673 meth(reply_handler = self.reply_handler, 678 meth(reply_handler=self.reply_handler,
674 error_handler = self.error_handler) 679 error_handler=self.error_handler)
675 except Exception as e: 680 except Exception as e:
676 s = "Error running method<br>Exception: " 681 s = "Error running method<br>Exception: "
677 self._return_entry.entry = s + utf8_to_markup(str(e)) 682 self._return_entry.entry = s + utf8_to_markup(str(e))