changeset 800:e0770d977d58

xmlui: added boolean type management in XMLUIResult2DataFormResult
author Goffi <goffi@goffi.org>
date Tue, 04 Feb 2014 18:04:32 +0100
parents 7f2082b192ed
children 02ee9ef95277
files src/tools/xml_tools.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/tools/xml_tools.py	Tue Feb 04 18:03:53 2014 +0100
+++ b/src/tools/xml_tools.py	Tue Feb 04 18:04:32 2014 +0100
@@ -49,6 +49,10 @@
             __field_type = "string"
         elif field.fieldType == 'text-private':
             __field_type = "password"
+        elif field.fieldType == 'boolean':
+            __field_type = "bool"
+            if field.value is None:
+                field.value = "false"
         elif field.fieldType == 'list-single':
             __field_type = "list"
         else:
@@ -387,6 +391,10 @@
 
     def addBool(self, name=None, value="true"):
         """Add a string box"""
+        if value=="0":
+            value="false"
+        elif value=="1":
+            value="true"
         assert value in ["true", "false"]
         elem = self._createElem('bool', name, self.currentLayout)
         elem.setAttribute('value', value)