diff mercurial/extensions.py @ 14943:d3bb825ddae3

globally: use safehasattr(x, '__call__') instead of hasattr(x, '__call__')
author Augie Fackler <durin42@gmail.com>
date Mon, 25 Jul 2011 16:24:37 -0500
parents 558ec14ba6be
children 56da00994067
line wrap: on
line diff
--- a/mercurial/extensions.py	Mon Jul 25 14:59:55 2011 -0500
+++ b/mercurial/extensions.py	Mon Jul 25 16:24:37 2011 -0500
@@ -124,7 +124,7 @@
     where orig is the original (wrapped) function, and *args, **kwargs
     are the arguments passed to it.
     '''
-    assert hasattr(wrapper, '__call__')
+    assert util.safehasattr(wrapper, '__call__')
     aliases, entry = cmdutil.findcmd(command, table)
     for alias, e in table.iteritems():
         if e is entry:
@@ -177,12 +177,12 @@
     your end users, you should play nicely with others by using the
     subclass trick.
     '''
-    assert hasattr(wrapper, '__call__')
+    assert util.safehasattr(wrapper, '__call__')
     def wrap(*args, **kwargs):
         return wrapper(origfn, *args, **kwargs)
 
     origfn = getattr(container, funcname)
-    assert hasattr(origfn, '__call__')
+    assert util.safehasattr(origfn, '__call__')
     setattr(container, funcname, wrap)
     return origfn