Make _add_method fail gracefully

This commit is contained in:
Shadowfacts 2025-02-11 14:06:48 -05:00
parent 1787cf63cf
commit d6f40c2e45

View File

@ -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