diff frontends/src/primitivus/xmlui.py @ 762:aed7d99276b8

core (xml_tools), frontends: added a prefix to XMLUI form names in result data, to avoid name conflicts (e.g.: if a form has name "submit", and this name is also used internally by SàT)
author Goffi <goffi@goffi.org>
date Tue, 24 Dec 2013 15:43:22 +0100
parents 73a0077f80cc
children bfabeedbf32e
line wrap: on
line diff
--- a/frontends/src/primitivus/xmlui.py	Tue Dec 24 15:43:22 2013 +0100
+++ b/frontends/src/primitivus/xmlui.py	Tue Dec 24 15:43:22 2013 +0100
@@ -22,6 +22,9 @@
 from logging import debug, info, warning, error
 from xml.dom import minidom
 
+
+SAT_FORM_PREFIX = "SAT_FORM_"
+
 def getText(node):
     """Get child text nodes
     @param node: dom Node
@@ -254,13 +257,14 @@
     def onFormSubmitted(self, button):
         selected_values = []
         for ctrl_name in self.ctrl_list:
+            escaped = u"%s%s" % (SAT_FORM_PREFIX, ctrl_name)
             ctrl = self.ctrl_list[ctrl_name]
             if isinstance(ctrl['control'], sat_widgets.List):
-                selected_values.append((ctrl_name, u'\t'.join([option.value for option in ctrl['control'].getSelectedValues()])))
+                selected_values.append((escaped, u'\t'.join([option.value for option in ctrl['control'].getSelectedValues()])))
             elif isinstance(ctrl['control'], urwid.CheckBox):
-                selected_values.append((ctrl_name, "true" if ctrl['control'].get_state() else "false"))
+                selected_values.append((escaped, "true" if ctrl['control'].get_state() else "false"))
             else:
-                selected_values.append((ctrl_name, ctrl['control'].get_edit_text()))
+                selected_values.append((escaped, ctrl['control'].get_edit_text()))
         if self.misc.has_key('action_back'): #FIXME FIXME FIXME: WTF ! Must be cleaned
             raise NotImplementedError
         elif 'callback' in self.misc: # FIXME: this part is not needed anymore