git://git.onelab.eu
/
sfa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
48f2520
)
modify how we import callable methods
author
Tony Mack
<tmack@cs.princeton.edu>
Tue, 1 Dec 2009 15:15:35 +0000
(15:15 +0000)
committer
Tony Mack
<tmack@cs.princeton.edu>
Tue, 1 Dec 2009 15:15:35 +0000
(15:15 +0000)
sfa/util/api.py
patch
|
blob
|
history
diff --git
a/sfa/util/api.py
b/sfa/util/api.py
index
1b86aae
..
bcbea6f
100644
(file)
--- a/
sfa/util/api.py
+++ b/
sfa/util/api.py
@@
-103,9
+103,9
@@
class BaseAPI:
self.encoding = encoding
# flat list of method names
self.encoding = encoding
# flat list of method names
- methods_module = __import__(methods)
- self.methods_module = methods_module
- self.methods = methods_module.
methods.
all
+
+ self.methods_module = methods_module
= __import__(methods, fromlist=[methods])
+ self.methods = methods_module.all
# Better just be documenting the API
if config is None:
# Better just be documenting the API
if config is None:
@@
-136,7
+136,7
@@
class BaseAPI:
# Get new instance of method
try:
classname = method.split(".")[-1]
# Get new instance of method
try:
classname = method.split(".")[-1]
- module = __import__(self.methods_module.
methods.
__name__ + "." + method, globals(), locals(), [classname])
+ module = __import__(self.methods_module.__name__ + "." + method, globals(), locals(), [classname])
callablemethod = getattr(module, classname)(self)
return getattr(module, classname)(self)
except ImportError, AttributeError:
callablemethod = getattr(module, classname)(self)
return getattr(module, classname)(self)
except ImportError, AttributeError: