show value in dataforms if there is no label

This commit is contained in:
Yann Leboulanger 2008-11-07 22:22:58 +00:00
parent b68a7a944b
commit a76f6b0133
1 changed files with 4 additions and 1 deletions

View File

@ -247,7 +247,10 @@ class ListField(DataField):
for element in self.iterTags('option'):
v = element.getTagData('value')
if v is None: raise WrongFieldValue
yield (v, element.getAttr('label'))
l = element.getAttr('label')
if not l:
l = v
yield (v, l)
class ListSingleField(ListField, StringField):
'''Covers list-single and jid-single fields.'''