Commit a4576bd3 authored by Martin Matějek's avatar Martin Matějek

Quick hack to prevent crashing on malformed json files

parent 42f6538f
......@@ -73,10 +73,16 @@ class Notification:
skel_args['jinja_env'] = plug.get_jinja_env()
skel_obj = NotificationSkeleton(**skel_args)
json_data['skeleton'] = skel_obj # replace json data with skeleton instance
# quick and dirty hack
# TODO: Use json schema or another validation method
try:
skel_obj = NotificationSkeleton(**skel_args)
json_data['skeleton'] = skel_obj # replace json data with skeleton instance
return cls(**json_data)
return cls(**json_data)
except TypeError:
logger.warning("Malformed notification file - skipping")
return None
def is_valid(self, timestamp=None):
"""If notification is still valid based on multiple conditions"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment