comparison tools/xml_tools.py @ 95:be206a3d1a9b

Tarot game: score calculation - plugin tarot: score validity is now checked (some of attackers and defender must equal 91) - plugin tarot: new signal tarotGameScore to give the scores and winners/loosers - wix: score are now displayed at the end of the game - xml_tools: 'fixed' type is now managed in dataForm2xml
author Goffi <goffi@goffi.org>
date Wed, 02 Jun 2010 15:57:23 +0930
parents 39c672544593
children 94011f553cd0
comparison
equal deleted inserted replaced
94:1eb5ccead43c 95:be206a3d1a9b
44 elem.setAttribute('type','text') 44 elem.setAttribute('type','text')
45 text = doc.createTextNode('\n'.join(form.instructions)) 45 text = doc.createTextNode('\n'.join(form.instructions))
46 elem.appendChild(text) 46 elem.appendChild(text)
47 top_element.appendChild(elem) 47 top_element.appendChild(elem)
48 for field in form.fieldList: 48 for field in form.fieldList:
49 if field.fieldType == 'text-single': 49 if field.fieldType == 'fixed':
50 __field_type = 'text'
51 elif field.fieldType == 'text-single':
50 __field_type = "string" 52 __field_type = "string"
51 elif field.fieldType == 'text-private': 53 elif field.fieldType == 'text-private':
52 __field_type = "password" 54 __field_type = "password"
53 elif field.fieldType == 'list-single': 55 elif field.fieldType == 'list-single':
54 __field_type = "list" 56 __field_type = "list"
55 else: 57 else:
56 error (u"FIXME FIXME FIXME: Type [%s] is not managed yet by SàT" % field.fieldType) 58 error (u"FIXME FIXME FIXME: Type [%s] is not managed yet by SàT" % field.fieldType)
57 __field_type = "string" 59 __field_type = "string"
58 60
59 elem = doc.createElement('elem') 61 elem = doc.createElement('elem')
60 elem.setAttribute('name', field.var) 62 if field.var:
63 elem.setAttribute('name', field.var)
61 elem.setAttribute('type', __field_type) 64 elem.setAttribute('type', __field_type)
62 elem.setAttribute('label', field.label or "") 65 elem.setAttribute('label', field.label or "")
63 if field.value: 66 if field.value:
64 elem.setAttribute('value', field.value) 67 elem.setAttribute('value', field.value)
65 top_element.appendChild(elem) 68 top_element.appendChild(elem)