Changeset 50:a37c65be8203 for wokkel/data_form.py
- Timestamp:
- Jan 12, 2009, 9:10:58 PM (14 years ago)
- Branch:
- default
- Convert:
- svn:b33ecbfc-034c-dc11-8662-000475d9059e/trunk@158
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wokkel/data_form.py
r48 r50 1 1 # -*- test-case-name: wokkel.test.test_data_form -*- 2 2 # 3 # Copyright (c) 2003-200 8Ralph Meijer3 # Copyright (c) 2003-2009 Ralph Meijer 4 4 # See LICENSE for details. 5 5 … … 229 229 self.values = newValues 230 230 231 def toElement(self ):231 def toElement(self, asForm=False): 232 232 """ 233 233 Return the DOM representation of this Field. … … 239 239 240 240 field = domish.Element((NS_X_DATA, 'field')) 241 field['type'] = self.fieldType 241 242 if asForm or self.fieldType != 'text-single': 243 field['type'] = self.fieldType 242 244 243 245 if self.var is not None: … … 249 251 field.addElement('value', content=value) 250 252 251 if self.fieldType in ('list-single', 'list-multi'): 252 for option in self.options: 253 field.addChild(option.toElement()) 254 255 if self.label is not None: 256 field['label'] = self.label 257 258 if self.desc is not None: 259 field.addElement('desc', content=self.desc) 260 261 if self.required: 262 field.addElement('required') 253 if asForm: 254 if self.fieldType in ('list-single', 'list-multi'): 255 for option in self.options: 256 field.addChild(option.toElement()) 257 258 if self.label is not None: 259 field['label'] = self.label 260 261 if self.desc is not None: 262 field.addElement('desc', content=self.desc) 263 264 if self.required: 265 field.addElement('required') 263 266 264 267 return field … … 425 428 426 429 for field in self.fieldList: 427 form.addChild(field.toElement( ))430 form.addChild(field.toElement(self.formType=='form')) 428 431 429 432 return form
Note: See TracChangeset
for help on using the changeset viewer.