mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
/browse: Fix sorting on custom cols. Also specify sort order explicitly when sorting on boolean columns
This commit is contained in:
parent
973afc0733
commit
7dc8e70b71
@ -816,6 +816,10 @@ class SortKeyGenerator(object):
|
|||||||
if val is None:
|
if val is None:
|
||||||
val = ''
|
val = ''
|
||||||
val = val.lower()
|
val = val.lower()
|
||||||
|
|
||||||
|
elif dt == 'bool':
|
||||||
|
val = {True: 1, False: 2, None: 3}.get(val, 3)
|
||||||
|
|
||||||
yield val
|
yield val
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import operator, os, json
|
import operator, os, json
|
||||||
from binascii import hexlify, unhexlify
|
from binascii import hexlify, unhexlify
|
||||||
from urllib import quote
|
from urllib import quote, unquote
|
||||||
|
|
||||||
import cherrypy
|
import cherrypy
|
||||||
|
|
||||||
@ -482,6 +482,8 @@ class BrowseServer(object):
|
|||||||
|
|
||||||
@Endpoint(sort_type='list')
|
@Endpoint(sort_type='list')
|
||||||
def browse_matches(self, category=None, cid=None, list_sort=None):
|
def browse_matches(self, category=None, cid=None, list_sort=None):
|
||||||
|
if list_sort:
|
||||||
|
list_sort = unquote(list_sort)
|
||||||
if not cid:
|
if not cid:
|
||||||
raise cherrypy.HTTPError(404, 'invalid category id: %r'%cid)
|
raise cherrypy.HTTPError(404, 'invalid category id: %r'%cid)
|
||||||
categories = self.categories_cache()
|
categories = self.categories_cache()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user