mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 14:53:06 +02:00
Fix (I hope) #896832 - datetimes - errors when sorting metadata
This commit is contained in:
parent
390ed2e982
commit
f31ac513d2
2 changed files with 4 additions and 3 deletions
|
|
@ -305,7 +305,8 @@ def merge(self, results, min_year, do_asr=True):
|
|||
ans.pubdate = r.pubdate
|
||||
break
|
||||
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:
|
||||
min_date = datetime(min_year, 1, 2, tzinfo=utc_tz)
|
||||
ans.pubdate = min_date
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
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
|
||||
from calibre.library.comments import comments_to_html
|
||||
from calibre import force_unicode
|
||||
# }}}
|
||||
|
|
@ -201,7 +201,7 @@ def sort(self, col, order=Qt.AscendingOrder):
|
|||
elif col == 1:
|
||||
key = attrgetter('title')
|
||||
elif col == 2:
|
||||
key = attrgetter('pubdate')
|
||||
key = lambda x: x.pubdate if x.pubdate else UNDEFINED_DATE
|
||||
elif col == 3:
|
||||
key = attrgetter('has_cached_cover_url')
|
||||
elif key == 4:
|
||||
|
|
|
|||
Loading…
Reference in a new issue