Skip to content

Commit

Permalink
comments can be sometimes None in addition to []
Browse files Browse the repository at this point in the history
  • Loading branch information
Augustin-FL committed May 30, 2023
1 parent d997f5a commit 52b935f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/views/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
def remove_field(instance, field):
try:
del instance[field]
except KeyError:
except (KeyError, TypeError):
pass


Expand Down Expand Up @@ -50,7 +50,7 @@ def clean_analyses(analyses):


def enrich_comments(obj):
if 'comments' in obj:
if 'comments' in obj and isinstance(obj, list):
for comment in obj['comments']:
if 'analyst' in comment:
analyst = store.users.find_one({'_id': comment['analyst']})
Expand Down

0 comments on commit 52b935f

Please sign in to comment.