comparison tools/xml_tools.py @ 146:7c00c4b0a5c2

xml_tools: removed unused content parameter in addElement
author Goffi <goffi@goffi.org>
date Wed, 28 Jul 2010 19:52:01 +0800
parents 5ae370c71803
children f494cba56a9e
comparison
equal deleted inserted replaced
145:c8b231abfe96 146:7c00c4b0a5c2
53 if field.label: 53 if field.label:
54 form_ui.addLabel(field.label) 54 form_ui.addLabel(field.label)
55 else: 55 else:
56 form_ui.addEmpty() 56 form_ui.addEmpty()
57 57
58 elem = form_ui.addElement(__field_type, field.var, None, field.value, [option.value for option in field.options]) 58 elem = form_ui.addElement(__field_type, field.var, field.value, [option.value for option in field.options])
59 return form_ui.toXml() 59 return form_ui.toXml()
60 60
61 def tupleList2dataForm(values): 61 def tupleList2dataForm(values):
62 """convert a list of tuples (name,value) to a wokkel submit data form""" 62 """convert a list of tuples (name,value) to a wokkel submit data form"""
63 form = data_form.Form('submit') 63 form = data_form.Form('submit')
231 fback_el.setAttribute('name', field) 231 fback_el.setAttribute('name', field)
232 elem.appendChild(fback_el) 232 elem.appendChild(fback_el)
233 233
234 234
235 235
236 def addElement(self, type, name = None, content = None, value = None, options = None, callback_id = None): 236 def addElement(self, type, name = None, value = None, options = None, callback_id = None):
237 """Convenience method to add element, the params correspond to the ones in addSomething methods""" 237 """Convenience method to add element, the params correspond to the ones in addSomething methods"""
238 if type == 'empty': 238 if type == 'empty':
239 self.addEmpty(name) 239 self.addEmpty(name)
240 elif type == 'text': 240 elif type == 'text':
241 assert(content) 241 assert(value!=None)
242 self.addText(content, name) 242 self.addText(value, name)
243 elif type == 'label': 243 elif type == 'label':
244 assert(value) 244 assert(value)
245 self.addLabel(value)
245 elif type == 'string': 246 elif type == 'string':
246 self.addString(name, value) 247 self.addString(name, value)
247 elif type == 'password': 248 elif type == 'password':
248 self.addPassword(name, value) 249 self.addPassword(name, value)
249 elif type == 'textbox': 250 elif type == 'textbox':