Better sorting in collection management

This commit is contained in:
Charles Haley 2010-12-04 16:52:27 +00:00
parent d9cd3fd0b0
commit 0e3a2fc39d

View File

@ -216,14 +216,17 @@ class CollectionsBookList(BookList):
elif is_series: elif is_series:
if doing_dc: if doing_dc:
collections[cat_name][lpath] = \ collections[cat_name][lpath] = \
(book, book.get('series_index', sys.maxint), '') (book, book.get('series_index', sys.maxint),
book.get('title_sort', 'zzzz'))
else: else:
collections[cat_name][lpath] = \ collections[cat_name][lpath] = \
(book, book.get(attr+'_index', sys.maxint), '') (book, book.get(attr+'_index', sys.maxint),
book.get('title_sort', 'zzzz'))
else: else:
if lpath not in collections[cat_name]: if lpath not in collections[cat_name]:
collections[cat_name][lpath] = \ collections[cat_name][lpath] = \
(book, book.get('title_sort', 'zzzz'), '') (book, book.get('title_sort', 'zzzz'),
book.get('title_sort', 'zzzz'))
# Sort collections # Sort collections
result = {} result = {}
@ -237,7 +240,7 @@ class CollectionsBookList(BookList):
return 1 return 1
if y is None: if y is None:
return -1 return -1
if isinstance(x, unicode): if isinstance(x, (unicode, str)):
c = cmp(sort_key(x), sort_key(y)) c = cmp(sort_key(x), sort_key(y))
else: else:
c = cmp(x, y) c = cmp(x, y)