comparison 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
comparison
equal deleted inserted replaced
3731:7e51cfc36d4e 3732:0fac164ff2d8
87 log.warning(_("Fixed field has neither value nor label, ignoring it")) 87 log.warning(_("Fixed field has neither value nor label, ignoring it"))
88 field.value = "" 88 field.value = ""
89 else: 89 else:
90 field.value = field.label 90 field.value = field.label
91 field.label = None 91 field.label = None
92 widget_args[0] = field.value 92 widget_args = [field.value]
93 elif field.fieldType == "text-single": 93 elif field.fieldType == "text-single":
94 widget_type = "string" 94 widget_type = "string"
95 widget_kwargs["read_only"] = read_only 95 widget_kwargs["read_only"] = read_only
96 elif field.fieldType == "jid-single": 96 elif field.fieldType == "jid-single":
97 widget_type = "jid_input" 97 widget_type = "jid_input"
98 widget_kwargs["read_only"] = read_only 98 widget_kwargs["read_only"] = read_only
99 elif field.fieldType == "text-multi": 99 elif field.fieldType == "text-multi":
100 widget_type = "textbox" 100 widget_type = "textbox"
101 widget_args[0] = "\n".join(field.values) 101 widget_args = ["\n".join(field.values)]
102 widget_kwargs["read_only"] = read_only 102 widget_kwargs["read_only"] = read_only
103 elif field.fieldType == "hidden": 103 elif field.fieldType == "hidden":
104 widget_type = "hidden" 104 widget_type = "hidden"
105 elif field.fieldType == "text-private": 105 elif field.fieldType == "text-private":
106 widget_type = "password" 106 widget_type = "password"
107 widget_kwargs["read_only"] = read_only 107 widget_kwargs["read_only"] = read_only
108 elif field.fieldType == "boolean": 108 elif field.fieldType == "boolean":
109 widget_type = "bool" 109 widget_type = "bool"
110 if widget_args[0] is None: 110 if widget_args[0] is None:
111 widget_args[0] = "false" 111 widget_args = ["false"]
112 widget_kwargs["read_only"] = read_only 112 widget_kwargs["read_only"] = read_only
113 elif field.fieldType == "integer": 113 elif field.fieldType == "integer":
114 widget_type = "integer" 114 widget_type = "integer"
115 widget_kwargs["read_only"] = read_only 115 widget_kwargs["read_only"] = read_only
116 elif field.fieldType == "list-single": 116 elif field.fieldType == "list-single":