Remove eval from from run_hook
authorvrde <agranzot@gmail.com>
Mon, 16 Sep 2013 19:26:55 +0000 (21:26 +0200)
committervrde <agranzot@gmail.com>
Mon, 16 Sep 2013 19:26:55 +0000 (21:26 +0200)
small improvement to remove eval using builtin function `getattr`.

gui/gui_classic/main_window.py

index 36085ba..7cddbbf 100644 (file)
@@ -466,10 +466,11 @@ class ElectrumWindow(QMainWindow):
         for p in self.plugins:
             if not p.is_enabled():
                 continue
-            try:
-                f = eval('p.'+name)
-            except:
-                continue
+
+            f = getattr(p, name, None)
+            if not callable(f):
+                return
+
             try:
                 apply(f, args)
             except: