From 6f60439f14132bb5db4499a0d47f7561c60408ce Mon Sep 17 00:00:00 2001 From: Andrew Chin Date: Sun, 20 Mar 2011 00:37:34 -0400 Subject: [PATCH] accept callables in the configFile with type="function" --- configParser.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configParser.py b/configParser.py index 7ed285d..8ca9eba 100644 --- a/configParser.py +++ b/configParser.py @@ -131,6 +131,9 @@ class ConfigOptionParser(object): configResults.__dict__[n] = long(configResults.__dict__[n]) elif a['type'] == "complex": configResults.__dict__[n] = complex(configResults.__dict__[n]) + elif a['type'] == "function": + if not callable(configResults.__dict__[n]): + raise ValueError("Not callable") else: print "Unknown type!" sys.exit(1)