Make empty_value accept a callable.
Fixes bug 999370. Change-Id: I0c3f830396645b261e4eb71c7b3d59560c913c6f
This commit is contained in:
parent
cb48cebefc
commit
7fed6d6620
@ -112,8 +112,8 @@ class Column(html.HTMLElement):
|
|||||||
|
|
||||||
.. attribute:: empty_value
|
.. attribute:: empty_value
|
||||||
|
|
||||||
A string to be used for cells which have no data. Defaults to an
|
A string or callable to be used for cells which have no data.
|
||||||
empty string.
|
Defaults to the string ``"-"``.
|
||||||
|
|
||||||
.. attribute:: filters
|
.. attribute:: filters
|
||||||
|
|
||||||
@ -441,7 +441,12 @@ class Cell(html.HTMLElement):
|
|||||||
attributes.
|
attributes.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
data = self.column.get_data(self.datum) or self.column.empty_value
|
data = self.column.get_data(self.datum)
|
||||||
|
if data is None:
|
||||||
|
if callable(self.column.empty_value):
|
||||||
|
data = self.column.empty_value(self.datum)
|
||||||
|
else:
|
||||||
|
data = self.column.empty_value
|
||||||
except:
|
except:
|
||||||
data = None
|
data = None
|
||||||
exc_info = sys.exc_info()
|
exc_info = sys.exc_info()
|
||||||
|
Loading…
Reference in New Issue
Block a user