From dde5b08c47cf92fa05bb0fcbaaf77b25f03de23b Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sat, 27 Jun 2020 13:36:33 +0200 Subject: [PATCH] Re enabled gevent as dependency Fix #1399 (Calibre-web starting with installed and not activated gdrive denpendencies without internet connection again) --- cps/admin.py | 2 +- cps/gdriveutils.py | 11 ++++++++--- optional-requirements.txt | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cps/admin.py b/cps/admin.py index d2e3bd87..5698fc5a 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -724,7 +724,7 @@ def _configuration_result(error_flash=None, gdriveError=None): gdriveError = _(gdriveError) else: # if config.config_use_google_drive and\ - if not gdrive_authenticate: + if not gdrive_authenticate and gdrive_support: gdrivefolders = gdriveutils.listRootFolders() show_back_button = current_user.is_authenticated diff --git a/cps/gdriveutils.py b/cps/gdriveutils.py index d53044bd..987a8405 100644 --- a/cps/gdriveutils.py +++ b/cps/gdriveutils.py @@ -33,6 +33,7 @@ try: from pydrive.drive import GoogleDrive from pydrive.auth import RefreshError from apiclient import errors + from httplib2 import ServerNotFoundError gdrive_support = True except ImportError: gdrive_support = False @@ -192,9 +193,13 @@ def getDrive(drive=None, gauth=None): return drive def listRootFolders(): - drive = getDrive(Gdrive.Instance().drive) - folder = "'root' in parents and mimeType = 'application/vnd.google-apps.folder' and trashed = false" - fileList = drive.ListFile({'q': folder}).GetList() + try: + drive = getDrive(Gdrive.Instance().drive) + folder = "'root' in parents and mimeType = 'application/vnd.google-apps.folder' and trashed = false" + fileList = drive.ListFile({'q': folder}).GetList() + except ServerNotFoundError as e: + log.info("GDrive Error %s" % e) + fileList = [] return fileList diff --git a/optional-requirements.txt b/optional-requirements.txt index 5cef4a05..6537a077 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -1,6 +1,6 @@ # GDrive Integration 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 httplib2>=0.9.2,<0.18.0 oauth2client>=4.0.0,<4.1.4