This commit is contained in:
Ozzieisaacs 2020-04-14 18:28:16 +02:00
parent a8b36aed92
commit 3fbaba6693
6 changed files with 31 additions and 14 deletions

View File

@ -42,6 +42,8 @@ from .helper import speaking_language, check_valid_domain, send_test_mail, reset
from .gdriveutils import is_gdrive_ready, gdrive_support
from .web import admin_required, render_title_template, before_request, unconfigured, login_required_if_no_ano
log = logger.create()
feature_support = {
'ldap': bool(services.ldap),
'goodreads': bool(services.goodreads_support),
@ -57,7 +59,8 @@ feature_support = {
try:
from .oauth_bb import oauth_check, oauthblueprints
feature_support['oauth'] = True
except ImportError:
except ImportError as err:
log.debug('Cannot import Flask-Dance, login with Oauth will not work: %s', err)
feature_support['oauth'] = False
oauthblueprints = []
oauth_check = {}
@ -65,7 +68,7 @@ except ImportError:
feature_support['gdrive'] = gdrive_support
admi = Blueprint('admin', __name__)
log = logger.create()
@admi.route("/admin")

View File

@ -23,7 +23,16 @@ from flask import session
try:
from flask_dance.consumer.backend.sqla import SQLAlchemyBackend, first, _get_real_user
from sqlalchemy.orm.exc import NoResultFound
except ImportError:
# fails on flask-dance >1.3, due to renaming
try:
from flask_dance.consumer.storage.sqla import SQLAlchemyStorage as SQLAlchemyBackend
from flask_dance.consumer.storage.sqla import first, _get_real_user
from sqlalchemy.orm.exc import NoResultFound
except ImportError:
pass
try:
class OAuthBackend(SQLAlchemyBackend):
"""
Stores and retrieves OAuth tokens using a relational database through
@ -152,5 +161,5 @@ try:
blueprint=blueprint, user=user, user_id=user_id,
))
except ImportError:
except Exception:
pass

View File

@ -26,7 +26,7 @@ log = logger.create()
try: from . import goodreads_support
except ImportError as err:
log.debug("cannot import goodreads, showing authors-metadata will not work: %s", err)
log.debug("Cannot import goodreads, showing authors-metadata will not work: %s", err)
goodreads_support = None
@ -34,7 +34,7 @@ try:
from . import simpleldap as ldap
from .simpleldap import ldapVersion
except ImportError as err:
log.debug("cannot import simpleldap, logging in with ldap will not work: %s", err)
log.debug("Cannot import simpleldap, logging in with ldap will not work: %s", err)
ldap = None
ldapVersion = None
@ -42,6 +42,6 @@ try:
from . import SyncToken as SyncToken
kobo = True
except ImportError as err:
log.debug("cannot import SyncToken, syncing books with Kobo Devices will not work: %s", err)
log.debug("Cannot import SyncToken, syncing books with Kobo Devices will not work: %s", err)
kobo = None
SyncToken = None

View File

@ -29,6 +29,11 @@ from werkzeug.local import LocalProxy
try:
from flask_dance.consumer.backend.sqla import OAuthConsumerMixin
oauth_support = True
except ImportError:
# fails on flask-dance >1.3, due to renaming
try:
from flask_dance.consumer.storage.sqla import OAuthConsumerMixin
oauth_support = True
except ImportError:
oauth_support = False
from sqlalchemy import create_engine, exc, exists

View File

@ -1,16 +1,16 @@
# GDrive Integration
google-api-python-client==1.7.11,<1.8.0
gevent>=1.2.1,<1.5.0
gevent>=1.2.1,<1.6.0
greenlet>=0.4.12,<0.5.0
httplib2>=0.9.2,<0.18.0
oauth2client>=4.0.0,<4.14.0
uritemplate>=3.0.0,<3.1.0
pyasn1-modules>=0.0.8,<0.3.0
pyasn1>=0.1.9,<0.5.0
PyDrive>=1.3.1,<1.14.0
PyDrive>=1.3.1,<1.4.0
PyYAML>=3.12
rsa==3.4.2,<4.1.0
six>=1.10.0,<1.14.0
six>=1.10.0,<1.15.0
# goodreads
goodreads>=0.3.2,<0.4.0
@ -21,12 +21,12 @@ python_ldap>=3.0.0,<3.3.0
flask-simpleldap>1.3.0,<1.5.0
#oauth
flask-dance>=0.13.0,<1.4.0
flask-dance>=1.4.0,<3.1.0
sqlalchemy_utils>=0.33.5,<0.37.0
# extracting metadata
lxml>=3.8.0,<4.6.0
Pillow>=4.0.0,<7.1.0
Pillow>=4.0.0,<7.2.0
rarfile>=2.7
# other

View File

@ -1,14 +1,14 @@
Babel>=1.3, <2.9
Flask-Babel>=0.11.1,<1.1.0
Flask-Login>=0.3.2,<0.5.1
Flask-Principal>=0.3.2,<0.5.0
Flask-Principal>=0.3.2,<0.5.1
singledispatch>=3.4.0.0,<3.5.0.0
backports_abc>=0.4
Flask>=1.0.2,<1.2.0
iso-639>=0.4.5,<0.5.0
PyPDF2==1.26.0,<1.27.0
pytz>=2016.10
requests>=2.11.1,<2.23.0
requests>=2.11.1,<2.24.0
SQLAlchemy>=1.1.0,<1.4.0
tornado>=4.1,<6.1
Wand>=0.4.4,<0.6.0