[brubru] fallback to field 's identifier (var) when there is no Human-readable name (label). Fixes #4894

This commit is contained in:
Yann Leboulanger 2009-03-11 09:47:16 +00:00
parent 5bc09c2a6a
commit 93fd47256d
1 changed files with 8 additions and 2 deletions

View File

@ -159,7 +159,10 @@ class DataField(ExtendedNode):
def label():
'''Human-readable field name.'''
def fget(self):
return self.getAttr('label')
l = self.getAttr('label')
if not l:
l = self.var
return l
def fset(self, value):
assert isinstance(value, basestring)
@ -263,7 +266,10 @@ class ListField(DataField):
v = element.getTagData('value')
if v is None:
raise WrongFieldValue
options.append((element.getAttr('label'), v))
l = element.getAttr('label')
if not l:
l = v
options.append((l, v))
return options
def fset(self, values):