Fix #1307
This commit is contained in:
parent
a8b36aed92
commit
3fbaba6693
|
@ -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 .gdriveutils import is_gdrive_ready, gdrive_support
|
||||||
from .web import admin_required, render_title_template, before_request, unconfigured, login_required_if_no_ano
|
from .web import admin_required, render_title_template, before_request, unconfigured, login_required_if_no_ano
|
||||||
|
|
||||||
|
log = logger.create()
|
||||||
|
|
||||||
feature_support = {
|
feature_support = {
|
||||||
'ldap': bool(services.ldap),
|
'ldap': bool(services.ldap),
|
||||||
'goodreads': bool(services.goodreads_support),
|
'goodreads': bool(services.goodreads_support),
|
||||||
|
@ -57,7 +59,8 @@ feature_support = {
|
||||||
try:
|
try:
|
||||||
from .oauth_bb import oauth_check, oauthblueprints
|
from .oauth_bb import oauth_check, oauthblueprints
|
||||||
feature_support['oauth'] = True
|
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
|
feature_support['oauth'] = False
|
||||||
oauthblueprints = []
|
oauthblueprints = []
|
||||||
oauth_check = {}
|
oauth_check = {}
|
||||||
|
@ -65,7 +68,7 @@ except ImportError:
|
||||||
|
|
||||||
feature_support['gdrive'] = gdrive_support
|
feature_support['gdrive'] = gdrive_support
|
||||||
admi = Blueprint('admin', __name__)
|
admi = Blueprint('admin', __name__)
|
||||||
log = logger.create()
|
|
||||||
|
|
||||||
|
|
||||||
@admi.route("/admin")
|
@admi.route("/admin")
|
||||||
|
|
11
cps/oauth.py
11
cps/oauth.py
|
@ -23,7 +23,16 @@ from flask import session
|
||||||
try:
|
try:
|
||||||
from flask_dance.consumer.backend.sqla import SQLAlchemyBackend, first, _get_real_user
|
from flask_dance.consumer.backend.sqla import SQLAlchemyBackend, first, _get_real_user
|
||||||
from sqlalchemy.orm.exc import NoResultFound
|
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):
|
class OAuthBackend(SQLAlchemyBackend):
|
||||||
"""
|
"""
|
||||||
Stores and retrieves OAuth tokens using a relational database through
|
Stores and retrieves OAuth tokens using a relational database through
|
||||||
|
@ -152,5 +161,5 @@ try:
|
||||||
blueprint=blueprint, user=user, user_id=user_id,
|
blueprint=blueprint, user=user, user_id=user_id,
|
||||||
))
|
))
|
||||||
|
|
||||||
except ImportError:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -26,7 +26,7 @@ log = logger.create()
|
||||||
|
|
||||||
try: from . import goodreads_support
|
try: from . import goodreads_support
|
||||||
except ImportError as err:
|
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
|
goodreads_support = None
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ try:
|
||||||
from . import simpleldap as ldap
|
from . import simpleldap as ldap
|
||||||
from .simpleldap import ldapVersion
|
from .simpleldap import ldapVersion
|
||||||
except ImportError as err:
|
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
|
ldap = None
|
||||||
ldapVersion = None
|
ldapVersion = None
|
||||||
|
|
||||||
|
@ -42,6 +42,6 @@ try:
|
||||||
from . import SyncToken as SyncToken
|
from . import SyncToken as SyncToken
|
||||||
kobo = True
|
kobo = True
|
||||||
except ImportError as err:
|
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
|
kobo = None
|
||||||
SyncToken = None
|
SyncToken = None
|
||||||
|
|
|
@ -30,6 +30,11 @@ try:
|
||||||
from flask_dance.consumer.backend.sqla import OAuthConsumerMixin
|
from flask_dance.consumer.backend.sqla import OAuthConsumerMixin
|
||||||
oauth_support = True
|
oauth_support = True
|
||||||
except ImportError:
|
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
|
oauth_support = False
|
||||||
from sqlalchemy import create_engine, exc, exists
|
from sqlalchemy import create_engine, exc, exists
|
||||||
from sqlalchemy import Column, ForeignKey
|
from sqlalchemy import Column, ForeignKey
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
# GDrive Integration
|
# GDrive Integration
|
||||||
google-api-python-client==1.7.11,<1.8.0
|
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
|
greenlet>=0.4.12,<0.5.0
|
||||||
httplib2>=0.9.2,<0.18.0
|
httplib2>=0.9.2,<0.18.0
|
||||||
oauth2client>=4.0.0,<4.14.0
|
oauth2client>=4.0.0,<4.14.0
|
||||||
uritemplate>=3.0.0,<3.1.0
|
uritemplate>=3.0.0,<3.1.0
|
||||||
pyasn1-modules>=0.0.8,<0.3.0
|
pyasn1-modules>=0.0.8,<0.3.0
|
||||||
pyasn1>=0.1.9,<0.5.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
|
PyYAML>=3.12
|
||||||
rsa==3.4.2,<4.1.0
|
rsa==3.4.2,<4.1.0
|
||||||
six>=1.10.0,<1.14.0
|
six>=1.10.0,<1.15.0
|
||||||
|
|
||||||
# goodreads
|
# goodreads
|
||||||
goodreads>=0.3.2,<0.4.0
|
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
|
flask-simpleldap>1.3.0,<1.5.0
|
||||||
|
|
||||||
#oauth
|
#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
|
sqlalchemy_utils>=0.33.5,<0.37.0
|
||||||
|
|
||||||
# extracting metadata
|
# extracting metadata
|
||||||
lxml>=3.8.0,<4.6.0
|
lxml>=3.8.0,<4.6.0
|
||||||
Pillow>=4.0.0,<7.1.0
|
Pillow>=4.0.0,<7.2.0
|
||||||
rarfile>=2.7
|
rarfile>=2.7
|
||||||
|
|
||||||
# other
|
# other
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
Babel>=1.3, <2.9
|
Babel>=1.3, <2.9
|
||||||
Flask-Babel>=0.11.1,<1.1.0
|
Flask-Babel>=0.11.1,<1.1.0
|
||||||
Flask-Login>=0.3.2,<0.5.1
|
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
|
singledispatch>=3.4.0.0,<3.5.0.0
|
||||||
backports_abc>=0.4
|
backports_abc>=0.4
|
||||||
Flask>=1.0.2,<1.2.0
|
Flask>=1.0.2,<1.2.0
|
||||||
iso-639>=0.4.5,<0.5.0
|
iso-639>=0.4.5,<0.5.0
|
||||||
PyPDF2==1.26.0,<1.27.0
|
PyPDF2==1.26.0,<1.27.0
|
||||||
pytz>=2016.10
|
pytz>=2016.10
|
||||||
requests>=2.11.1,<2.23.0
|
requests>=2.11.1,<2.24.0
|
||||||
SQLAlchemy>=1.1.0,<1.4.0
|
SQLAlchemy>=1.1.0,<1.4.0
|
||||||
tornado>=4.1,<6.1
|
tornado>=4.1,<6.1
|
||||||
Wand>=0.4.4,<0.6.0
|
Wand>=0.4.4,<0.6.0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user