fix: Avoid exception is published is not set

pull/417/head
Raphaël Vinot 2022-05-11 16:54:21 +02:00
parent 56bf9d08ba
commit 959e4e6920
1 changed files with 4 additions and 1 deletions

View File

@ -94,7 +94,10 @@ class MISP():
try:
# NOTE: POST the event as published publishes inline, which can tak a long time.
# Here, we POST as not published, and trigger the publishing in a second call.
background_publish = event.published
if hasattr(event, 'published'):
background_publish = event.published
else:
background_publish = False
if background_publish:
event.published = False
new_event = self.client.add_event(event, pythonify=True)