Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix TypeError due to Bool arguments in ElementTree
Caused due to presence of Boolean arguments (False) while writing to `game.xml`. If `speak` is not set, it defaults to `False` in get_speak() in `card.py`. The fix changes `False` to an empty String while writing to `game.xml`. Traceback: ``` 1594050507.412289 ERROR root: Error saving activity object to datastore Traceback (most recent call last): File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 1076, in _escape_attrib if "&" in text: TypeError: argument of type 'bool' is not iterable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/sugar3/activity/activity.py", line 1277, in _prepare_close self.save() File "/usr/lib/python3/dist-packages/sugar3/activity/activity.py", line 978, in save self.write_file(file_path) File "/usr/share/sugar/activities/Memorize.activity/activity.py", line 409, in write_file self.game.model.write() File "/usr/share/sugar/activities/Memorize.activity/model.py", line 357, in write xml_file.write(tostring(root)) File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 1133, in tostring ElementTree(element).write(stream, encoding, File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 772, in write serialize(write, self._root, qnames, namespaces, File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 937, in _serialize_xml _serialize_xml(write, e, qnames, None, File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 930, in _serialize_xml v = _escape_attrib(v) File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 1099, in _escape_attrib _raise_serialization_error(text) File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 1053, in _raise_serialization_error raise TypeError( TypeError: cannot serialize False (type bool) ``` Fixes #29
- Loading branch information