Skip to content

Commit

Permalink
Make migration resilient to older importjson formats
Browse files Browse the repository at this point in the history
  • Loading branch information
fbanados committed Dec 10, 2024
1 parent 2c24472 commit e4992e8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/morphodict/lexicon/migrations/0016_auto_20241202_1907.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ def migrate_from_linguistinfo(apps, schema_editor):
if not wf.linguist_info:
continue
if "rw_indices" in wf.linguist_info:
rapidwords = {
rw for l in wf.linguist_info["rw_indices"].values() for rw in l
}
if isinstance(wf.linguist_info["rw_indices"], dict):
rapidwords = {
rw for l in wf.linguist_info["rw_indices"].values() for rw in l
}
elif isinstance(wf.linguist_info["rw_indices"],list):
rapidwords = [rw for rw in wf.linguist_info["rw_indices"]]
else:
continue
for rw in rapidwords:
index = rw.strip()
try:
Expand Down

0 comments on commit e4992e8

Please sign in to comment.