From 9c20169e0aa9966fc396118621e12efffe9e57b1 Mon Sep 17 00:00:00 2001 From: "John N. Milner" Date: Tue, 18 Jun 2024 19:17:57 -0400 Subject: [PATCH] =?UTF-8?q?Remove=20brittle=20and=20now=20unnecessary=20fl?= =?UTF-8?q?attening=20of=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `file` columns in `select_one_from_file` and `select_multiple_from_file` rows. This was causing a `KeyError` when the asset content predated Flattening of `{"type": "select_one_from_file", "file": "choices.csv"}` (and equivalent `select_multiple_from_file` structures) to the XLSForm-standard `{"type": "select_one_from_file choices.csv"}` is handled by kobotoolbox/formpack#318 and kobotoolbox/formpack#319. --- kpi/models/asset_snapshot.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/kpi/models/asset_snapshot.py b/kpi/models/asset_snapshot.py index f362db06e0..e25a09853d 100644 --- a/kpi/models/asset_snapshot.py +++ b/kpi/models/asset_snapshot.py @@ -214,12 +214,6 @@ def generate_xml_from_source(self, warnings = [] details = {} - for row in source_copy['survey']: - if row.get('type') in ['select_one_from_file', 'select_multiple_from_file']: - ff = row.pop('file') - _type = row.pop('type') - row['type'] = f'{_type} {ff}' - try: xml = FormPack({'content': source_copy}, root_node_name=root_node_name,