From af724a295ded9d93292ff9258e77bad51c76e0a6 Mon Sep 17 00:00:00 2001 From: "John N. Milner" Date: Tue, 21 Jan 2025 18:13:56 -0500 Subject: [PATCH] Cope with breaking changes in pyxform 3.0.0 Beginning with XLSForm/pyxform#740, `SurveyElement` inherits from `Mapping` instead of `dict`, and therefore has no `update()` method. See https://github.com/XLSForm/pyxform/commit/6918b400d3cf6c9151db2104137afe2c52dd68e4 --- src/formpack/version.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/formpack/version.py b/src/formpack/version.py index e584915..6f45441 100644 --- a/src/formpack/version.py +++ b/src/formpack/version.py @@ -438,13 +438,14 @@ def to_xml(self, warnings=None): if title is None: raise ValueError('cannot create xml on a survey with no title.') - survey.update( - { - 'name': self.lookup('root_node_name', 'data'), - 'id_string': self.lookup('id_string'), - 'title': self.lookup('title'), - 'version': self.lookup('id'), - } - ) + # pyxform 3.0.0 has removed the ability to call `survey.update()` + # https://github.com/XLSForm/pyxform/commit/6918b400d3cf6c9151db2104137afe2c52dd68e4 + for k, v in { + 'name': self.lookup('root_node_name', 'data'), + 'id_string': self.lookup('id_string'), + 'title': self.lookup('title'), + 'version': self.lookup('id'), + }.items(): + survey[k] = v return survey._to_pretty_xml() # .encode('utf-8')