Mercurial > libervia-backend
comparison src/tools/xml_tools.py @ 800:e0770d977d58
xmlui: added boolean type management in XMLUIResult2DataFormResult
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 04 Feb 2014 18:04:32 +0100 |
parents | 8f5479f8709a |
children | 9007bb133009 |
comparison
equal
deleted
inserted
replaced
799:7f2082b192ed | 800:e0770d977d58 |
---|---|
47 __field_type = 'text' | 47 __field_type = 'text' |
48 elif field.fieldType == 'text-single': | 48 elif field.fieldType == 'text-single': |
49 __field_type = "string" | 49 __field_type = "string" |
50 elif field.fieldType == 'text-private': | 50 elif field.fieldType == 'text-private': |
51 __field_type = "password" | 51 __field_type = "password" |
52 elif field.fieldType == 'boolean': | |
53 __field_type = "bool" | |
54 if field.value is None: | |
55 field.value = "false" | |
52 elif field.fieldType == 'list-single': | 56 elif field.fieldType == 'list-single': |
53 __field_type = "list" | 57 __field_type = "list" |
54 else: | 58 else: |
55 error(u"FIXME FIXME FIXME: Type [%s] is not managed yet by SàT" % field.fieldType) | 59 error(u"FIXME FIXME FIXME: Type [%s] is not managed yet by SàT" % field.fieldType) |
56 __field_type = "string" | 60 __field_type = "string" |
385 elem.setAttribute('value', value) | 389 elem.setAttribute('value', value) |
386 return elem | 390 return elem |
387 | 391 |
388 def addBool(self, name=None, value="true"): | 392 def addBool(self, name=None, value="true"): |
389 """Add a string box""" | 393 """Add a string box""" |
394 if value=="0": | |
395 value="false" | |
396 elif value=="1": | |
397 value="true" | |
390 assert value in ["true", "false"] | 398 assert value in ["true", "false"] |
391 elem = self._createElem('bool', name, self.currentLayout) | 399 elem = self._createElem('bool', name, self.currentLayout) |
392 elem.setAttribute('value', value) | 400 elem.setAttribute('value', value) |
393 return elem | 401 return elem |
394 | 402 |