diff --git a/cps.py b/cps.py index 20aa9cac..32e9b43a 100755 --- a/cps.py +++ b/cps.py @@ -41,6 +41,7 @@ from cps.shelf import shelf from cps.admin import admi from cps.gdrive import gdrive from cps.editbooks import editbook +from cps.error_handler import init_errorhandler try: from cps.kobo import kobo, get_kobo_activated @@ -58,14 +59,17 @@ except ImportError: def main(): app = create_app() + + init_errorhandler() + app.register_blueprint(web) app.register_blueprint(opds) app.register_blueprint(jinjia) app.register_blueprint(about) app.register_blueprint(shelf) app.register_blueprint(admi) - if config.config_use_google_drive: - app.register_blueprint(gdrive) + # if config.config_use_google_drive: + app.register_blueprint(gdrive) app.register_blueprint(editbook) if kobo_available: app.register_blueprint(kobo) diff --git a/cps/admin.py b/cps/admin.py index 3f342374..8b3ca247 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -1327,7 +1327,7 @@ def import_ldap_users(): try: new_users = services.ldap.get_group_members(config.config_ldap_group_name) except (services.ldap.LDAPException, TypeError, AttributeError, KeyError) as e: - log.exception(e) + log.debug_or_exception(e) showtext['text'] = _(u'Error: %(ldaperror)s', ldaperror=e) return json.dumps(showtext) if not new_users: @@ -1355,7 +1355,7 @@ def import_ldap_users(): try: user_data = services.ldap.get_object_details(user=user_identifier, query_filter=query_filter) except AttributeError as e: - log.exception(e) + log.debug_or_exception(e) continue if user_data: user_login_field = extract_dynamic_field_from_filter(user, config.config_ldap_user_object) diff --git a/cps/error_handler.py b/cps/error_handler.py index e2e1638f..e9cb601a 100644 --- a/cps/error_handler.py +++ b/cps/error_handler.py @@ -48,20 +48,21 @@ def internal_error(error): instance=config.config_calibre_web_title ), 500 -# http error handling -for ex in default_exceptions: - if ex < 500: - app.register_error_handler(ex, error_http) - elif ex == 500: - app.register_error_handler(ex, internal_error) +def init_errorhandler(): + # http error handling + for ex in default_exceptions: + if ex < 500: + app.register_error_handler(ex, error_http) + elif ex == 500: + app.register_error_handler(ex, internal_error) -if services.ldap: - # Only way of catching the LDAPException upon logging in with LDAP server down - @app.errorhandler(services.ldap.LDAPException) - def handle_exception(e): - log.debug('LDAP server not accessible while trying to login to opds feed') - return error_http(FailedDependency()) + if services.ldap: + # Only way of catching the LDAPException upon logging in with LDAP server down + @app.errorhandler(services.ldap.LDAPException) + def handle_exception(e): + log.debug('LDAP server not accessible while trying to login to opds feed') + return error_http(FailedDependency()) # @app.errorhandler(InvalidRequestError) diff --git a/cps/opds.py b/cps/opds.py index 7689eacd..1ae7010c 100644 --- a/cps/opds.py +++ b/cps/opds.py @@ -28,7 +28,7 @@ from functools import wraps from flask import Blueprint, request, render_template, Response, g, make_response, abort from flask_login import current_user from sqlalchemy.sql.expression import func, text, or_, and_ - +from werkzeug.security import check_password_hash from . import constants, logger, config, db, calibre_db, ub, services, get_locale, isoLanguages from .helper import get_download_link, get_book_cover diff --git a/cps/templates/admin.html b/cps/templates/admin.html index 3fa86722..1ef64157 100644 --- a/cps/templates/admin.html +++ b/cps/templates/admin.html @@ -75,7 +75,7 @@ {% endif %} -
{{_('Edit Basic Configuration')}}
+
{{_('Edit E-mail Server Settings')}}
diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index 7b5c881b..dde602ab 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
-

Start Time: 2020-12-09 15:21:02

+

Start Time: 2020-12-12 12:19:43

-

Stop Time: 2020-12-09 17:53:34

+

Stop Time: 2020-12-12 14:23:09

-

Duration: 1h 57 min

+

Duration: 1h 33 min

@@ -236,13 +236,13 @@ _ErrorHolder - 1 + 29 0 0 - 1 + 29 0 - Detail + Detail @@ -265,19 +265,1069 @@
Traceback (most recent call last):
-  File "/home/matthias/Entwicklung/calibre-web-test/test/test_anonymous.py", line 23, in tearDownClass
+  File "/home/matthias/Entwicklung/calibre-web-test/test/test_anonymous.py", line 27, in tearDownClass
+    save_logfiles(cls, cls.__name__)
+  File "/home/matthias/Entwicklung/calibre-web-test/test/helper_func.py", line 352, in save_logfiles
+    inst.assertFalse(result,"Exception in File {}".format(file))
+  File "/usr/lib/python3.8/unittest/case.py", line 758, in assertFalse
+    msg = self._formatMessage(msg, "%s is not false" % safe_repr(expr))
+AttributeError: 'bool' object has no attribute '_formatMessage'
+
+
+ + + + + + + + + +
tearDownClass (test_cli)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_cover_edit_books)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_delete_database)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_ebook_convert)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_ebook_convert_gdrive)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_ebook_convert_kepubify)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_ebook_convert_kepubify_gdrive)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_edit_additional_books)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_edit_books)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_edit_books_list)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_edit_ebooks_gdrive)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_email_STARTTLS)
+ + +
+ ERROR +
+ + + + + + + + + + +
setUpClass (test_email_ssl)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_gdrive_setup)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_goodreads)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_kobo_sync)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_ldap)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_logging)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_login)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_oauth)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_opds_feed)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_reader)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_register)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_shelf)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_updater)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_user_load)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_user_template)
+ + +
+ ERROR +
+ + + + + + + + + + +
tearDownClass (test_visiblilitys)
+ + +
+ ERROR +
+ + @@ -288,12 +1338,12 @@ selenium.common.exceptions.ElementNotInteractableException: Message: Element + TestCli 7 - 3 - 2 - 1 + 6 + 0 + 0 1 Detail @@ -311,68 +1361,20 @@ selenium.common.exceptions.ElementNotInteractableException: Message: Element +
TestCli - test_bind_to_single_interface
- -
- FAIL -
- - - - + PASS - +
TestCli - test_cli_SSL_files
- -
- FAIL -
- - - - + PASS @@ -386,35 +1388,11 @@ AssertionError: 'Error' is not None : HTTPS Connection could not established wit - +
TestCli - test_cli_different_settings_database
- -
- ERROR -
- - - - + PASS @@ -503,184 +1481,2861 @@ selenium.common.exceptions.TimeoutException: Message: - + TestEbookConvertCalibre - 11 - 11 + 22 0 0 + 22 0 - Detail + Detail - +
TestEbookConvertCalibre - test_convert_deactivate
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertCalibre - test_convert_deactivate
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibre - test_convert_email
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertCalibre - test_convert_email
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibre - test_convert_failed_and_email
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertCalibre - test_convert_failed_and_email
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibre - test_convert_only
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertCalibre - test_convert_only
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibre - test_convert_parameter
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertCalibre - test_convert_parameter
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibre - test_convert_wrong_excecutable
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertCalibre - test_convert_wrong_excecutable
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibre - test_email_failed
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertCalibre - test_email_failed
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibre - test_email_only
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertCalibre - test_email_only
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibre - test_kindle_send_not_configured
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertCalibre - test_kindle_send_not_configured
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibre - test_ssl_smtp_setup_error
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertCalibre - test_ssl_smtp_setup_error
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibre - test_starttls_smtp_setup_error
- PASS + +
+ ERROR +
+ + + + + + + + + + +
TestEbookConvertCalibre - test_starttls_smtp_setup_error
+ + +
+ ERROR +
+ + + + - + TestEbookConvertCalibreGDrive - 6 - 6 + 12 0 0 + 12 0 - Detail + Detail - +
TestEbookConvertCalibreGDrive - test_convert_email
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertCalibreGDrive - test_convert_email
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibreGDrive - test_convert_failed_and_email
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertCalibreGDrive - test_convert_failed_and_email
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibreGDrive - test_convert_only
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertCalibreGDrive - test_convert_only
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibreGDrive - test_convert_parameter
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertCalibreGDrive - test_convert_parameter
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibreGDrive - test_email_failed
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertCalibreGDrive - test_email_failed
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibreGDrive - test_email_only
- PASS + +
+ ERROR +
+ + + + + + + + + + +
TestEbookConvertCalibreGDrive - test_email_only
+ + +
+ ERROR +
+ + + + @@ -728,30 +4383,89 @@ selenium.common.exceptions.TimeoutException: Message: - + TestEbookConvertGDriveKepubify - 3 - 3 - 0 + 4 + 2 0 + 2 0 - Detail + Detail - +
TestEbookConvertGDriveKepubify - test_convert_deactivate
- PASS + +
+ ERROR +
+ + + + - + + +
TestEbookConvertGDriveKepubify - test_convert_deactivate
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertGDriveKepubify - test_convert_only
@@ -760,7 +4474,7 @@ selenium.common.exceptions.TimeoutException: Message: - +
TestEbookConvertGDriveKepubify - test_convert_wrong_excecutable
@@ -770,11 +4484,11 @@ selenium.common.exceptions.TimeoutException: Message: - + TestEditAdditionalBooks 13 - 11 - 1 + 12 + 0 0 1 @@ -874,33 +4588,11 @@ selenium.common.exceptions.TimeoutException: Message: - +
TestEditAdditionalBooks - test_upload_metadata_cbt
- -
- FAIL -
- - - - + PASS @@ -941,11 +4633,11 @@ AssertionError: 'Test 执 to' != 'book' - + TestEditBooks 33 - 28 - 3 + 31 + 0 0 2 @@ -1214,64 +4906,20 @@ AssertionError: 'Test 执 to' != 'book' - +
TestEditBooks - test_upload_book_cbt
- -
- FAIL -
- - - - + PASS - +
TestEditBooks - test_upload_book_cbz
- -
- FAIL -
- - - - + PASS @@ -1321,31 +4969,11 @@ AssertionError: '8936' != '19501' - +
TestEditBooks - test_upload_cover_hdd
- -
- FAIL -
- - - - + PASS @@ -1393,13 +5021,13 @@ AssertionError: False is not true - + TestEditBooksOnGdrive 20 - 19 - 1 0 0 + 20 + 0 Detail @@ -1407,188 +5035,86 @@ AssertionError: False is not true - +
TestEditBooksOnGdrive - test_download_book
- PASS - - - - - - -
TestEditBooksOnGdrive - test_edit_author
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_edit_category
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_edit_comments
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_edit_custom_bool
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_edit_custom_categories
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_edit_custom_float
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_edit_custom_int
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_edit_custom_rating
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_edit_custom_single_select
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_edit_custom_text
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_edit_language
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_edit_publisher
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_edit_rating
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_edit_series
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_edit_title
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_upload_book_epub
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_upload_book_lit
- - PASS - - - - - - -
TestEditBooksOnGdrive - test_upload_cover_hdd
-
- FAIL + ERROR
-