comparison tools/xml_tools.py @ 91:39c672544593

Tarot: bidding phase - quick_app: command line is now parsed, "profile" option allow to select it - xml_tools: list-single is now managed - plugin tarot: method and signal to manage contract (contrat): tarotChooseContrat & tarotGameContratChoosed - wix: Q&D Form hack to manage more generic form (not only registration), used to show contract selection form
author Goffi <goffi@goffi.org>
date Thu, 27 May 2010 19:26:19 +0930
parents a5b5fb5fc9fd
children be206a3d1a9b
comparison
equal deleted inserted replaced
90:4020931569b8 91:39c672544593
48 for field in form.fieldList: 48 for field in form.fieldList:
49 if field.fieldType == 'text-single': 49 if field.fieldType == 'text-single':
50 __field_type = "string" 50 __field_type = "string"
51 elif field.fieldType == 'text-private': 51 elif field.fieldType == 'text-private':
52 __field_type = "password" 52 __field_type = "password"
53 elif field.fieldType == 'list-single':
54 __field_type = "list"
53 else: 55 else:
54 error (u"FIXME FIXME FIXME: Type [%s] is not managed yet by SàT" % field.fieldType) 56 error (u"FIXME FIXME FIXME: Type [%s] is not managed yet by SàT" % field.fieldType)
55 __field_type = "string" 57 __field_type = "string"
56 58
57 elem = doc.createElement('elem') 59 elem = doc.createElement('elem')
58 elem.setAttribute('name', field.var) 60 elem.setAttribute('name', field.var)
59 elem.setAttribute('type', __field_type) 61 elem.setAttribute('type', __field_type)
60 elem.setAttribute('label', field.label or "") 62 elem.setAttribute('label', field.label or "")
61 if field.value: 63 if field.value:
62 text = doc.createTextNode(field.value) 64 elem.setAttribute('value', field.value)
63 elem.appendChild(text)
64 top_element.appendChild(elem) 65 top_element.appendChild(elem)
66 for option in field.options:
67 opt = doc.createElement('option')
68 opt.setAttribute('value', option.value)
69 elem.appendChild(opt)
65 result = doc.toxml() 70 result = doc.toxml()
66 doc.unlink() 71 doc.unlink()
67 return result 72 return result
68 73
69 @staticmethod 74 @staticmethod