Back out changes to the CustomMarking decorator and registration,

to revert its behavior to what it did before: register a type
for old-style non-extension custom markings.
pull/1/head
Michael Chisholm 2021-07-08 22:18:28 -04:00
parent 10956d305a
commit d27e9e6e55
2 changed files with 1 additions and 16 deletions

View File

@ -53,11 +53,6 @@ def _custom_marking_builder(cls, type, properties, version, base_class):
def __init__(self, **kwargs):
base_class.__init__(self, **kwargs)
_cls_init(cls, self, kwargs)
ext = getattr(self, 'with_extension', None)
if ext and version != '2.0':
if 'extensions' not in self._inner:
self._inner['extensions'] = {}
self._inner['extensions'][ext] = _get_extension_class(ext, version)()
_CustomMarking.__name__ = cls.__name__

View File

@ -252,7 +252,7 @@ OBJ_MAP_MARKING = {
}
def CustomMarking(type='x-custom-marking', properties=None, extension_name=None):
def CustomMarking(type='x-custom-marking', properties=None):
"""Custom STIX Marking decorator.
Example:
@ -267,16 +267,6 @@ def CustomMarking(type='x-custom-marking', properties=None, extension_name=None)
"""
def wrapper(cls):
if extension_name:
@CustomExtension(type=extension_name, properties=properties)
class NameExtension:
extension_type = 'property-extension'
extension = extension_name.split('--')[1]
extension = extension.replace('-', '')
NameExtension.__name__ = 'ExtensionDefinition' + extension
cls.with_extension = extension_name
return _custom_marking_builder(cls, type, MarkingDefinition._properties, '2.1', _STIXBase21)
return _custom_marking_builder(cls, type, properties, '2.1', _STIXBase21)
return wrapper