diff --git a/src/stdui/ui_profile_manager.py b/src/stdui/ui_profile_manager.py index 9a4c76e8..3ffe74a1 100644 --- a/src/stdui/ui_profile_manager.py +++ b/src/stdui/ui_profile_manager.py @@ -65,7 +65,7 @@ class ProfileManager(object): return self._verifyPassword(data_, profile) callback_id = self.host.registerCallback(xmlui_cb, with_data=True, one_shot=True) - form_ui = xml_tools.XMLUI("form", title=D_('Profile password for %s') % profile, submit_id=callback_id) + form_ui = xml_tools.XMLUI("form", title=D_('Profile password for {}').format(profile), submit_id=callback_id) form_ui.addPassword('profile_password', value='') return {'xmlui': form_ui.toXml()} diff --git a/src/tools/xml_tools.py b/src/tools/xml_tools.py index 4c78bb95..bcaf301e 100644 --- a/src/tools/xml_tools.py +++ b/src/tools/xml_tools.py @@ -1065,7 +1065,7 @@ class XMLUI(object): @param submit_id: callback id to call for panel_type we can submit (form, param, dialog) @param session_id: use to keep a session attached to the dialog, must be returned by frontends """ - self._introspect() + self._introspect() # FIXME: why doing that on each XMLUI ? should be done once if panel_type not in [C.XMLUI_WINDOW, C.XMLUI_FORM, C.XMLUI_PARAM, C.XMLUI_POPUP, C.XMLUI_DIALOG]: raise exceptions.DataError(_("Unknown panel type [%s]") % panel_type) if panel_type == C.XMLUI_FORM and submit_id is None: @@ -1082,7 +1082,7 @@ class XMLUI(object): top_element.setAttribute("type", panel_type) if title: top_element.setAttribute("title", title) - self._submit_id = submit_id + self.submit_id = submit_id self.session_id = session_id if panel_type == C.XMLUI_DIALOG: if dialog_opt is None: @@ -1133,8 +1133,12 @@ class XMLUI(object): @property def submit_id(self): top_element = self.doc.documentElement + if not top_element.hasAttribute("submit"): + # getAttribute never return None (it return empty string it attribute doesn't exists) + # so we have to manage None here + return None value = top_element.getAttribute("submit") - return value or None + return value @submit_id.setter def submit_id(self, value): @@ -1168,7 +1172,7 @@ class XMLUI(object): def _createDialog(self, dialog_opt): dialog_type = dialog_opt.setdefault(C.XMLUI_DATA_TYPE, C.XMLUI_DIALOG_MESSAGE) - if dialog_type in [C.XMLUI_DIALOG_CONFIRM, C.XMLUI_DIALOG_FILE] and self._submit_id is None: + if dialog_type in [C.XMLUI_DIALOG_CONFIRM, C.XMLUI_DIALOG_FILE] and self.submit_id is None: raise exceptions.InternalError(_("Submit ID must be filled for this kind of dialog")) top_element = TopElement(self) level = dialog_opt.get(C.XMLUI_DATA_LVL) @@ -1253,7 +1257,7 @@ def deferXMLUI(host, xmlui, profile): @param profile: %(doc_profile)s @return (data): a deferred which fire the data """ - assert xmlui._submit_id == '' # xmlui.submit_id can't be the empty string, but xmlui._submit_id must here + assert xmlui.submit_id == '' xmlui_d = defer.Deferred() def onSubmit(data, profile):