changeset 2958:e2cb04b381bb

tools (xml_tools): added "read_only" argument in dataFormResult2XMLUI (and use it in plugin pubsub_schema)
author Goffi <goffi@goffi.org>
date Wed, 12 Jun 2019 09:11:28 +0200
parents 8fd8c9f548cd
children 989b622faff6
files sat/plugins/plugin_exp_pubsub_schema.py sat/tools/xml_tools.py
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_exp_pubsub_schema.py	Sun May 26 22:30:09 2019 +0200
+++ b/sat/plugins/plugin_exp_pubsub_schema.py	Wed Jun 12 09:11:28 2019 +0200
@@ -311,6 +311,7 @@
                         ("text", item_elt.getAttribute("publisher", ""), u"publisher"),
                     ),
                     filters=filters,
+                    read_only=False,
                 )
                 items_xmlui.append(xmlui)
                 break
--- a/sat/tools/xml_tools.py	Sun May 26 22:30:09 2019 +0200
+++ b/sat/tools/xml_tools.py	Wed Jun 12 09:11:28 2019 +0200
@@ -287,9 +287,8 @@
     return xml_ui
 
 
-def dataFormResult2XMLUI(
-    result_form, base_form, session_id=None, prepend=None, filters=None
-):
+def dataFormResult2XMLUI(result_form, base_form, session_id=None, prepend=None,
+                         filters=None, read_only=True):
     """Convert data form result to SàT XMLUI.
 
     @param result_form (data_form.Form): result form to convert
@@ -298,6 +297,7 @@
     @param session_id (unicode): session id to return with the data
     @param prepend: same as for [dataForm2Widgets]
     @param filters: same as for [dataForm2Widgets]
+    @param read_only: same as for [dataForm2Widgets]
     @return: XMLUI instance
     """
     # we deepcopy the form because _dataFormField2XMLUIData can modify the value
@@ -312,7 +312,7 @@
             continue
         field.options = base_field.options[:]
     xml_ui = XMLUI("window", "vertical", session_id=session_id)
-    dataForm2Widgets(xml_ui, form, read_only=True, prepend=prepend, filters=filters)
+    dataForm2Widgets(xml_ui, form, read_only=read_only, prepend=prepend, filters=filters)
     return xml_ui