Skip to content

Commit

Permalink
Merge pull request #1517 from lucasmarchd01/issue-1515
Browse files Browse the repository at this point in the history
Fix `TypeError` in `get_suggested_chant()`
  • Loading branch information
lucasmarchd01 authored Jun 7, 2024
2 parents 914fbf3 + 4546291 commit 6638001
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions django/cantusdb_project/cantusindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,12 @@ def get_suggested_chant(
# mostly, in case of a timeout within get_json_from_ci_api
return None

fulltext: str = json["info"]["field_full_text"]
incipit: str = " ".join(fulltext.split(" ")[:5])
genre_name: str = json["info"]["field_genre"]
try:
fulltext: str = json["info"]["field_full_text"]
incipit: str = " ".join(fulltext.split(" ")[:5])
genre_name: str = json["info"]["field_genre"]
except TypeError:
return None
genre_id: Optional[int] = None
try:
genre_id = Genre.objects.get(name=genre_name).id
Expand Down

0 comments on commit 6638001

Please sign in to comment.