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
|
||||
done.append(clazz)
|
||||
assert clazz.__name__ != "DefaultTable", "Oops, table class not found."
|
||||
assert not hasattr(
|
||||
clazz, method.__name__
|
||||
), "Oops, class '%s' has method '%s'." % (clazz.__name__, method.__name__)
|
||||
setattr(clazz, method.__name__, method)
|
||||
if not hasattr(clazz, method.__name__):
|
||||
setattr(clazz, method.__name__, method)
|
||||
return None
|
||||
|
||||
return wrapper
|
||||
|
Loading…
x
Reference in New Issue
Block a user