mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Fix #896832 (datetimes - errors when sorting metadata)
This commit is contained in:
parent
f55e5efa2a
commit
6a84d88d0d
@ -28,7 +28,8 @@ from calibre.ebooks.metadata.sources.identify import (identify,
|
||||
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 @@ class ResultsModel(QAbstractTableModel): # {{{
|
||||
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…
x
Reference in New Issue
Block a user