mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
459899a11a
commit
57f41246e7
@ -26,13 +26,13 @@ def ensure_val(x, *allowed):
|
|||||||
x = allowed[0]
|
x = allowed[0]
|
||||||
return x
|
return x
|
||||||
|
|
||||||
def get_pagination(query):
|
def get_pagination(query, num=100, offset=0):
|
||||||
try:
|
try:
|
||||||
num = int(query.get('num', 100))
|
num = int(query.get('num', num))
|
||||||
except:
|
except:
|
||||||
raise HTTPNotFound("Invalid num")
|
raise HTTPNotFound("Invalid num")
|
||||||
try:
|
try:
|
||||||
offset = int(query.get('offset', 0))
|
offset = int(query.get('offset', offset))
|
||||||
except:
|
except:
|
||||||
raise HTTPNotFound("Invalid offset")
|
raise HTTPNotFound("Invalid offset")
|
||||||
return num, offset
|
return num, offset
|
||||||
@ -526,7 +526,7 @@ def search(ctx, rd, library_id):
|
|||||||
'''
|
'''
|
||||||
Return the books (as list of ids) matching the specified search query.
|
Return the books (as list of ids) matching the specified search query.
|
||||||
|
|
||||||
Optional: ?num=100&offset=0&sort=title&sort_order=asc&get_additional_fields=
|
Optional: ?num=100&offset=0&sort=title&sort_order=asc&query=
|
||||||
'''
|
'''
|
||||||
db = get_db(ctx, library_id)
|
db = get_db(ctx, library_id)
|
||||||
with db.safe_read_lock:
|
with db.safe_read_lock:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user