Commit 7b789b37 authored by Ozzieisaacs's avatar Ozzieisaacs

Fix opds with shelves

Fix errorhandler ldap without ldap
parent 0480d493
...@@ -344,12 +344,12 @@ def feed_shelf(book_id): ...@@ -344,12 +344,12 @@ def feed_shelf(book_id):
off = request.args.get("offset") or 0 off = request.args.get("offset") or 0
if current_user.is_anonymous: if current_user.is_anonymous:
shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.is_public == 1, shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.is_public == 1,
ub.Shelf.id == book_id, not ub.Shelf.deleted).first() ub.Shelf.id == book_id).first()
else: else:
shelf = ub.session.query(ub.Shelf).filter(or_(and_(ub.Shelf.user_id == int(current_user.id), shelf = ub.session.query(ub.Shelf).filter(or_(and_(ub.Shelf.user_id == int(current_user.id),
ub.Shelf.id == book_id), ub.Shelf.id == book_id),
and_(ub.Shelf.is_public == 1, and_(ub.Shelf.is_public == 1,
ub.Shelf.id == book_id)), not ub.Shelf.deleted).first() ub.Shelf.id == book_id))).first()
result = list() result = list()
# user is allowed to access shelf # user is allowed to access shelf
if shelf: if shelf:
......
...@@ -112,9 +112,10 @@ for ex in default_exceptions: ...@@ -112,9 +112,10 @@ for ex in default_exceptions:
app.register_error_handler(ex, internal_error) app.register_error_handler(ex, internal_error)
# Only way of catching the LDAPException upon logging in with LDAP server down if feature_support['ldap']:
@app.errorhandler(services.ldap.LDAPException) # Only way of catching the LDAPException upon logging in with LDAP server down
def handle_exception(e): @app.errorhandler(services.ldap.LDAPException)
def handle_exception(e):
log.debug('LDAP server not accessible while trying to login to opds feed') log.debug('LDAP server not accessible while trying to login to opds feed')
return error_http(FailedDependency()) return error_http(FailedDependency())
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment