Make _add_method fail gracefully
This commit is contained in:
parent
1787cf63cf
commit
d6f40c2e45
@ -12,10 +12,8 @@ def _add_method(*clazzes):
|
|||||||
continue # Support multiple names of a clazz
|
continue # Support multiple names of a clazz
|
||||||
done.append(clazz)
|
done.append(clazz)
|
||||||
assert clazz.__name__ != "DefaultTable", "Oops, table class not found."
|
assert clazz.__name__ != "DefaultTable", "Oops, table class not found."
|
||||||
assert not hasattr(
|
if not hasattr(clazz, method.__name__):
|
||||||
clazz, method.__name__
|
setattr(clazz, method.__name__, method)
|
||||||
), "Oops, class '%s' has method '%s'." % (clazz.__name__, method.__name__)
|
|
||||||
setattr(clazz, method.__name__, method)
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
Loading…
x
Reference in New Issue
Block a user