mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 20:35:18 +02:00
Fix #896832 (datetimes - errors when sorting metadata)
This commit is contained in:
parent
f55e5efa2a
commit
6a84d88d0d
1 changed files with 8 additions and 2 deletions
|
|
@ -28,7 +28,8 @@
|
|||
urls_from_identifiers)
|
||||
from calibre.ebooks.metadata.book.base import Metadata
|
||||
from calibre.gui2 import error_dialog, NONE
|
||||
from calibre.utils.date import utcnow, fromordinal, format_date
|
||||
from calibre.utils.date import (utcnow, fromordinal, format_date,
|
||||
UNDEFINED_DATE, as_utc)
|
||||
from calibre.library.comments import comments_to_html
|
||||
from calibre import force_unicode
|
||||
# }}}
|
||||
|
|
@ -201,7 +202,12 @@ def sort(self, col, order=Qt.AscendingOrder):
|
|||
elif col == 1:
|
||||
key = attrgetter('title')
|
||||
elif col == 2:
|
||||
key = attrgetter('pubdate')
|
||||
def dategetter(x):
|
||||
x = getattr(x, 'pubdate', None)
|
||||
if x is None:
|
||||
x = UNDEFINED_DATE
|
||||
return as_utc(x)
|
||||
key = dategetter
|
||||
elif col == 3:
|
||||
key = attrgetter('has_cached_cover_url')
|
||||
elif key == 4:
|
||||
|
|
|
|||
Loading…
Reference in a new issue