Bug #1247348. This change might change behavior of something. Before, any int or float that was None or zero returned an empty string. Now only None values do that. The previous behavior did not work properly with zero values in templates, including series indices.

This commit is contained in:
Charles Haley 2013-11-02 12:35:31 +01:00
parent d68718166b
commit 05b45937fa

View File

@ -33,8 +33,7 @@ class SafeFormat(TemplateFormatter):
b = self.book.get_user_metadata(key, False)
except:
b = None
if b and ((b['datatype'] == 'int' and self.book.get(key, 0) == 0) or
(b['datatype'] == 'float' and self.book.get(key, 0.0) == 0.0)):
if (b and b['datatype'] in ['int', 'float'] and self.book.get(key, None) == None):
v = ''
else:
v = self.book.format_field(key, series_with_index=False)[1]