diff sat/tools/xml_tools.py @ 3732:0fac164ff2d8

tools (xml_tools): fix `widget_args` modification in `_dataFormField2XMLUIData`: in `textbox` widget, the first arg was modified with all values, lettings other ones unchanger, resulting in invalid number of arguments. This has been fixed by replacing all args with the new value.
author Goffi <goffi@goffi.org>
date Mon, 31 Jan 2022 18:35:52 +0100
parents d33da3fe34a5
children 384b7e6c2dbf
line wrap: on
line diff
--- a/sat/tools/xml_tools.py	Mon Jan 31 18:35:52 2022 +0100
+++ b/sat/tools/xml_tools.py	Mon Jan 31 18:35:52 2022 +0100
@@ -89,7 +89,7 @@
             else:
                 field.value = field.label
                 field.label = None
-            widget_args[0] = field.value
+            widget_args = [field.value]
     elif field.fieldType == "text-single":
         widget_type = "string"
         widget_kwargs["read_only"] = read_only
@@ -98,7 +98,7 @@
         widget_kwargs["read_only"] = read_only
     elif field.fieldType == "text-multi":
         widget_type = "textbox"
-        widget_args[0] = "\n".join(field.values)
+        widget_args = ["\n".join(field.values)]
         widget_kwargs["read_only"] = read_only
     elif field.fieldType == "hidden":
         widget_type = "hidden"
@@ -108,7 +108,7 @@
     elif field.fieldType == "boolean":
         widget_type = "bool"
         if widget_args[0] is None:
-            widget_args[0] = "false"
+            widget_args = ["false"]
         widget_kwargs["read_only"] = read_only
     elif field.fieldType == "integer":
         widget_type = "integer"