Re enabled gevent as dependency

Fix #1399 (Calibre-web starting with installed and not activated gdrive denpendencies without internet connection again)
This commit is contained in:
Ozzieisaacs 2020-06-27 13:36:33 +02:00
parent 88d2c60ee8
commit dde5b08c47
3 changed files with 10 additions and 5 deletions

View File

@ -724,7 +724,7 @@ def _configuration_result(error_flash=None, gdriveError=None):
gdriveError = _(gdriveError) gdriveError = _(gdriveError)
else: else:
# if config.config_use_google_drive and\ # if config.config_use_google_drive and\
if not gdrive_authenticate: if not gdrive_authenticate and gdrive_support:
gdrivefolders = gdriveutils.listRootFolders() gdrivefolders = gdriveutils.listRootFolders()
show_back_button = current_user.is_authenticated show_back_button = current_user.is_authenticated

View File

@ -33,6 +33,7 @@ try:
from pydrive.drive import GoogleDrive from pydrive.drive import GoogleDrive
from pydrive.auth import RefreshError from pydrive.auth import RefreshError
from apiclient import errors from apiclient import errors
from httplib2 import ServerNotFoundError
gdrive_support = True gdrive_support = True
except ImportError: except ImportError:
gdrive_support = False gdrive_support = False
@ -192,9 +193,13 @@ def getDrive(drive=None, gauth=None):
return drive return drive
def listRootFolders(): def listRootFolders():
try:
drive = getDrive(Gdrive.Instance().drive) drive = getDrive(Gdrive.Instance().drive)
folder = "'root' in parents and mimeType = 'application/vnd.google-apps.folder' and trashed = false" folder = "'root' in parents and mimeType = 'application/vnd.google-apps.folder' and trashed = false"
fileList = drive.ListFile({'q': folder}).GetList() fileList = drive.ListFile({'q': folder}).GetList()
except ServerNotFoundError as e:
log.info("GDrive Error %s" % e)
fileList = []
return fileList return fileList

View File

@ -1,6 +1,6 @@
# 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,<20.6.0 gevent>=1.2.1,<20.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.1.4 oauth2client>=4.0.0,<4.1.4