mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
d68718166b
commit
05b45937fa
@ -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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user