From 93fd47256d556c8441dd6a4756ea72500f6b578f Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Wed, 11 Mar 2009 09:47:16 +0000
Subject: [PATCH] [brubru] fallback to field 's identifier (var) when there is
 no Human-readable name (label). Fixes #4894

---
 src/common/dataforms.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/common/dataforms.py b/src/common/dataforms.py
index edfa4030a2..788a915013 100644
--- a/src/common/dataforms.py
+++ b/src/common/dataforms.py
@@ -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):
-- 
GitLab