mirror of https://github.com/MISP/PyMISP
fix: enable taxonomy failed if global pythonify is on
parent
2734224958
commit
aee6945e95
|
@ -1134,7 +1134,10 @@ class PyMISP:
|
|||
"""
|
||||
taxonomy_id = get_uuid_or_id_from_abstract_misp(taxonomy)
|
||||
t = self.get_taxonomy(taxonomy_id)
|
||||
if not t['Taxonomy']['enabled']:
|
||||
if isinstance(t, MISPTaxonomy) and not t.enabled:
|
||||
# Can happen if global pythonify is enabled.
|
||||
raise PyMISPError(f"The taxonomy {t.name} is not enabled.")
|
||||
elif not t['Taxonomy']['enabled']:
|
||||
raise PyMISPError(f"The taxonomy {t['Taxonomy']['name']} is not enabled.")
|
||||
url = urljoin(self.root_url, 'taxonomies/addTag/{}'.format(taxonomy_id))
|
||||
response = self._prepare_request('POST', url)
|
||||
|
|
|
@ -2054,6 +2054,9 @@ class MISPWarninglist(AbstractMISP):
|
|||
|
||||
class MISPTaxonomy(AbstractMISP):
|
||||
|
||||
name: str
|
||||
enabled: bool
|
||||
|
||||
def from_dict(self, **kwargs):
|
||||
if 'Taxonomy' in kwargs:
|
||||
kwargs = kwargs['Taxonomy']
|
||||
|
|
Loading…
Reference in New Issue