diff frontends/src/wix/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/wix/xmlui.py	Tue Dec 24 15:43:22 2013 +0100
+++ b/frontends/src/wix/xmlui.py	Tue Dec 24 15:43:22 2013 +0100
@@ -25,6 +25,8 @@
 from logging import debug, info, warning, error
 from sat.tools.jid  import JID
 
+SAT_FORM_PREFIX = "SAT_FORM_"
+
 
 class XMLUI(wx.Frame):
     """Create an user interface from a SàT xml"""
@@ -216,15 +218,16 @@
         debug(_("Submitting form"))
         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'], wx.ListBox):
                 label = ctrl['control'].GetStringSelection()
                 value = ctrl['attr_map'][label]
-                selected_values.append((ctrl_name, value))
+                selected_values.append((escaped, value))
             elif isinstance(ctrl['control'], wx.CheckBox):
-                selected_values.append((ctrl_name, "true" if ctrl['control'].GetValue() else "false"))
+                selected_values.append((escaped, "true" if ctrl['control'].GetValue() else "false"))
             else:
-                selected_values.append((ctrl_name, ctrl['control'].GetValue()))
+                selected_values.append((escaped, ctrl['control'].GetValue()))
         if self.misc.has_key('action_back'): #FIXME FIXME FIXME: WTF ! Must be cleaned
             id = self.misc['action_back']("SUBMIT",self.misc['target'], selected_values)
             self.host.current_action_ids.add(id)