From e4992e8311db4bf2f90b49578cd7fb7c05a8405c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Ba=C3=B1ados=20Schwerter?= Date: Tue, 10 Dec 2024 20:55:26 +0000 Subject: [PATCH] Make migration resilient to older importjson formats --- .../lexicon/migrations/0016_auto_20241202_1907.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/morphodict/lexicon/migrations/0016_auto_20241202_1907.py b/src/morphodict/lexicon/migrations/0016_auto_20241202_1907.py index e36ec2b4b..87ab8d0b0 100644 --- a/src/morphodict/lexicon/migrations/0016_auto_20241202_1907.py +++ b/src/morphodict/lexicon/migrations/0016_auto_20241202_1907.py @@ -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: