Fix a regression in calibre 2.0 that caused setting the value of a custom number column to zero via the book list to clear the field instead. Fixes #1363076 [The number zero doesn't appear](https://bugs.launchpad.net/calibre/+bug/1363076)

This commit is contained in:
Kovid Goyal 2014-08-29 18:45:33 +05:30
parent 8f18290228
commit ed8459397a

View File

@ -979,7 +979,10 @@ class BooksModel(QAbstractTableModel): # {{{
val = 0 if val < 0 else 5 if val > 5 else val val = 0 if val < 0 else 5 if val > 5 else val
val *= 2 val *= 2
elif typ in ('int', 'float'): elif typ in ('int', 'float'):
val = unicode(value or '').strip() if value == 0:
val = '0'
else:
val = unicode(value or '').strip()
if not val: if not val:
val = None val = None
elif typ == 'datetime': elif typ == 'datetime':