use the py3k version of callable()

This commit is contained in:
Benjamin Peterson
2009-01-10 13:04:23 -06:00
parent 5e1711ab21
commit 07c5a8b449
3 changed files with 3 additions and 3 deletions

View File

@@ -137,7 +137,7 @@ class Config(object):
if name not in self.values:
raise AttributeError('No such config value: %s' % name)
default = self.values[name][0]
if callable(default):
if hasattr(default, '__call__'):
return default(self)
return default

View File

@@ -166,7 +166,7 @@ def between(marker, what=None, keepempty=False):
def isdescriptor(x):
"""Check if the object is some kind of descriptor."""
for item in '__get__', '__set__', '__delete__':
if callable(getattr(x, item, None)):
if hasattr(getattr(x, item, None), '__call__'):
return True
return False

View File

@@ -129,7 +129,7 @@ def test_html(app):
for path, check in paths.iteritems():
nodes = list(etree.findall(path))
assert nodes != []
if callable(check):
if hasattr(check, '__call__'):
check(nodes)
elif not check:
# only check for node presence