Remove gratuitous use of eval in database.py
Zack Weinberg
zack at codesourcery.com
Wed May 18 20:13:34 UTC 2005
database.py uses eval when getattr will do.
zw
* qm/test/database.py (ItemDescriptor._Execute): Use getattr
and a bound method object instead of eval.
===================================================================
Index: qm/test/database.py
--- qm/test/database.py 3 Jan 2004 04:02:59 -0000 1.40
+++ qm/test/database.py 18 May 2005 20:11:07 -0000
@@ -163,11 +163,12 @@ class ItemDescriptor:
# Get the item.
item = self.GetItem()
+ methobj = getattr(item, method)
# Execute the indicated method.
if context is not None:
- eval("item.%s(context, result)" % method)
+ methobj(context, result)
else:
- eval("item.%s(result)" % method)
+ methobj(result)
More information about the qmtest
mailing list