mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix (I hope) #896832 - datetimes - errors when sorting metadata
This commit is contained in:
parent
390ed2e982
commit
f31ac513d2
@ -305,7 +305,8 @@ class ISBNMerge(object):
|
|||||||
ans.pubdate = r.pubdate
|
ans.pubdate = r.pubdate
|
||||||
break
|
break
|
||||||
if getattr(ans.pubdate, 'year', None) == min_year:
|
if getattr(ans.pubdate, 'year', None) == min_year:
|
||||||
min_date = datetime(min_year, ans.pubdate.month, ans.pubdate.day)
|
min_date = datetime(min_year, ans.pubdate.month, ans.pubdate.day,
|
||||||
|
tzinfo=utc_tz)
|
||||||
else:
|
else:
|
||||||
min_date = datetime(min_year, 1, 2, tzinfo=utc_tz)
|
min_date = datetime(min_year, 1, 2, tzinfo=utc_tz)
|
||||||
ans.pubdate = min_date
|
ans.pubdate = min_date
|
||||||
|
@ -28,7 +28,7 @@ from calibre.ebooks.metadata.sources.identify import (identify,
|
|||||||
urls_from_identifiers)
|
urls_from_identifiers)
|
||||||
from calibre.ebooks.metadata.book.base import Metadata
|
from calibre.ebooks.metadata.book.base import Metadata
|
||||||
from calibre.gui2 import error_dialog, NONE
|
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
|
||||||
from calibre.library.comments import comments_to_html
|
from calibre.library.comments import comments_to_html
|
||||||
from calibre import force_unicode
|
from calibre import force_unicode
|
||||||
# }}}
|
# }}}
|
||||||
@ -201,7 +201,7 @@ class ResultsModel(QAbstractTableModel): # {{{
|
|||||||
elif col == 1:
|
elif col == 1:
|
||||||
key = attrgetter('title')
|
key = attrgetter('title')
|
||||||
elif col == 2:
|
elif col == 2:
|
||||||
key = attrgetter('pubdate')
|
key = lambda x: x.pubdate if x.pubdate else UNDEFINED_DATE
|
||||||
elif col == 3:
|
elif col == 3:
|
||||||
key = attrgetter('has_cached_cover_url')
|
key = attrgetter('has_cached_cover_url')
|
||||||
elif key == 4:
|
elif key == 4:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user