[utils] support_args now support classes, searching if __init__ supports the arguments stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 28 Jan 2011 15:11:26 +0100
branchstable
changeset 6913 ab85124dc0eb
parent 6912 b61b844f2dad
child 6914 5be96d9cbedc
[utils] support_args now support classes, searching if __init__ supports the arguments
utils.py
--- a/utils.py	Fri Jan 28 11:08:31 2011 +0100
+++ b/utils.py	Fri Jan 28 15:11:26 2011 +0100
@@ -67,6 +67,8 @@
 
 def support_args(callable, *argnames):
     """return true if the callable support given argument names"""
+    if isinstance(callable, type):
+        callable = callable.__init__
     argspec = getargspec(callable)
     if argspec[2]:
         return True