Skip to content

Commit

Permalink
Remove brittle and now unnecessary flattening of…
Browse files Browse the repository at this point in the history
`file` columns in `select_one_from_file` and `select_multiple_from_file`
rows. This was causing a `KeyError` when the asset content predated #4403
and kobotoolbox/formpack#314.

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.
  • Loading branch information
jnm committed Jun 18, 2024
1 parent be33572 commit 22b5ac8
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions kpi/models/asset_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 22b5ac8

Please sign in to comment.