From ed8459397a8586f41d34c9b84cf8a58a993266de Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 29 Aug 2014 18:45:33 +0530 Subject: [PATCH] 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) --- src/calibre/gui2/library/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 0b1b94f84c..cf7afd2481 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -979,7 +979,10 @@ class BooksModel(QAbstractTableModel): # {{{ val = 0 if val < 0 else 5 if val > 5 else val val *= 2 elif typ in ('int', 'float'): - val = unicode(value or '').strip() + if value == 0: + val = '0' + else: + val = unicode(value or '').strip() if not val: val = None elif typ == 'datetime':