# HG changeset patch # User Goffi # Date 1725637546 -7200 # Node ID d2deddd6df4413f80336db67a295693c0c3ccbf3 # Parent 060d695ae98eed21161c2c0d582cbee92743a60a tools (xml_tools): add `namespace` argument to `xmlui_result_to_elt`: this allows to specify resulting Form namespace. diff -r 060d695ae98e -r d2deddd6df44 libervia/backend/tools/xml_tools.py --- a/libervia/backend/tools/xml_tools.py Fri Sep 06 17:44:08 2024 +0200 +++ b/libervia/backend/tools/xml_tools.py Fri Sep 06 17:45:46 2024 +0200 @@ -469,13 +469,14 @@ return C.bool(raw_xmlui.get("cancelled", C.BOOL_FALSE)) -def xmlui_result_to_elt(xmlui_data): +def xmlui_result_to_elt(xmlui_data: dict, namespace: str | None = None): """Construct result domish.Element from XMLUI result. - @param xmlui_data (dict): data returned by frontends for XMLUI form + @param xmlui_data: data returned by frontends for XMLUI form + @param namespace: namespace to use for the form. @return: domish.Element """ - form = data_form.Form("submit") + form = data_form.Form("submit", formNamespace=namespace) form.makeFields(xmlui_result_2_data_form_result(xmlui_data)) return form.toElement() @@ -1742,23 +1743,23 @@ def defer_xmlui( host, - xmlui, - action_extra=None, - security_limit=C.NO_SECURITY_LIMIT, - chained=False, - profile=C.PROF_KEY_NONE, -): + xmlui: XMLUI, + action_extra: dict | None = None, + security_limit: int = C.NO_SECURITY_LIMIT, + chained: bool = False, + profile: str = C.PROF_KEY_NONE, +) -> defer.Deferred[dict]: """Create a deferred linked to XMLUI - @param xmlui(XMLUI): instance of the XMLUI + @param xmlui: instance of the XMLUI Must be an XMLUI that you can submit, with submit_id set to '' @param profile: %(doc_profile)s - @param action_extra(None, dict): extra action to merge with xmlui + @param action_extra: extra action to merge with xmlui mainly used to add meta informations (see action_new doc) @param security_limit: %(doc_security_limit)s - @param chained(bool): True if the Deferred result must be returned to the frontend + @param chained: True if the Deferred result must be returned to the frontend useful when backend is in a series of dialogs with an ui - @return (data): a deferred which fire the data + @return: a deferred which fire the data """ xmlui_d = deferred_ui(host, xmlui, chained) action_data = {"xmlui": xmlui.toXml()}