Allow no custom __init__() on CustomMarking
parent
ef3ce9f6f0
commit
fbce8f15fe
|
@ -145,7 +145,14 @@ def CustomMarking(type='x-custom-marking', properties=None):
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
_STIXBase.__init__(self, **kwargs)
|
_STIXBase.__init__(self, **kwargs)
|
||||||
cls.__init__(self, **kwargs)
|
try:
|
||||||
|
cls.__init__(self, **kwargs)
|
||||||
|
except (AttributeError, TypeError) as e:
|
||||||
|
# Don't accidentally catch errors raised in a custom __init__()
|
||||||
|
if ("has no attribute '__init__'" in str(e) or
|
||||||
|
str(e) == "object.__init__() takes no parameters"):
|
||||||
|
return
|
||||||
|
raise e
|
||||||
|
|
||||||
_register_marking(_Custom)
|
_register_marking(_Custom)
|
||||||
return _Custom
|
return _Custom
|
||||||
|
|
Loading…
Reference in New Issue