diff --git a/cps/admin.py b/cps/admin.py index ae9da540..f222be02 100755 --- a/cps/admin.py +++ b/cps/admin.py @@ -1269,8 +1269,8 @@ def update_mailsettings(): _config_string(to_save, "mail_password") _config_int(to_save, "mail_size", lambda y: int(y)*1024*1024) config.mail_server = to_save.get('mail_server', "").strip() - config.mail_from = to_save.get('mail_login', "").strip() - config.email = to_save.get('mail_login', "").strip() + config.mail_from = to_save.get('mail_from', "").strip() + config.mail_login = to_save.get('mail_login', "").strip() try: config.save() except (OperationalError, InvalidRequestError) as e: @@ -1671,9 +1671,10 @@ def _db_configuration_update_helper(): if db_change or not db_valid or not config.db_configured \ or config.config_calibre_dir != to_save["config_calibre_dir"]: - if not calibre_db.setup_db(to_save['config_calibre_dir'], ub.app_DB_path): - return _db_configuration_result(_('DB Location is not Valid, Please Enter Correct Path'), - gdrive_error) + if not os.path.exists(metadata_db) or not to_save['config_calibre_dir']: + return _db_configuration_result(_('DB Location is not Valid, Please Enter Correct Path'), gdrive_error) + else: + calibre_db.setup_db(to_save['config_calibre_dir'], ub.app_DB_path) config.store_calibre_uuid(calibre_db, db.Library_Id) # if db changed -> delete shelfs, delete download books, delete read books, kobo sync... if db_change: diff --git a/cps/db.py b/cps/db.py index c4f7ed38..0b98f683 100644 --- a/cps/db.py +++ b/cps/db.py @@ -567,12 +567,12 @@ class CalibreDB: if not config_calibre_dir: cls.config.invalidate() - return False + return None dbpath = os.path.join(config_calibre_dir, "metadata.db") if not os.path.exists(dbpath): cls.config.invalidate() - return False + return None try: cls.engine = create_engine('sqlite://', @@ -588,7 +588,7 @@ class CalibreDB: # conn.text_factory = lambda b: b.decode(errors = 'ignore') possible fix for #1302 except Exception as ex: cls.config.invalidate(ex) - return False + return None cls.config.db_configured = True @@ -598,7 +598,7 @@ class CalibreDB: cls.setup_db_cc_classes(cc) except OperationalError as e: log.error_or_exception(e) - return False + return None cls.session_factory = scoped_session(sessionmaker(autocommit=False, autoflush=True, @@ -607,7 +607,6 @@ class CalibreDB: inst.init_session() cls._init = True - return True def get_book(self, book_id): return self.session.query(Books).filter(Books.id == book_id).first() diff --git a/cps/static/js/main.js b/cps/static/js/main.js index 04d47d6b..cfb0b2f0 100644 --- a/cps/static/js/main.js +++ b/cps/static/js/main.js @@ -677,8 +677,8 @@ $(function() { if ( data.change ) { if ( data.valid ) { confirmDialog( - "db_submit", - "GeneralChangeModal", + "db_submit", + "GeneralChangeModal", 0, changeDbSettings ); diff --git a/setup.cfg b/setup.cfg index aff22e9e..92e64f6a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -42,7 +42,7 @@ install_requires = werkzeug<2.1.0 Babel>=1.3,<3.0 Flask-Babel>=0.11.1,<2.1.0 - Flask-Login>=0.3.2,<0.6.1 + Flask-Login>=0.3.2,<0.6.2 Flask-Principal>=0.3.2,<0.5.1 backports_abc>=0.4 Flask>=1.0.2,<2.1.0 @@ -97,5 +97,5 @@ comics = natsort>=2.2.0,<8.2.0 comicapi>=2.2.0,<2.3.0 kobo = - jsonschema>=3.2.0,<4.5.0 + jsonschema>=3.2.0,<4.6.0 diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index 79fbdc61..8953c08c 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
Start Time: 2022-05-07 17:19:13
+Start Time: 2022-06-05 22:14:00
Stop Time: 2022-05-07 23:07:20
+Stop Time: 2022-06-06 04:06:43
Duration: 4h 55 min
+Duration: 4h 57 min
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert.py", line 223, in test_convert_email + self.assertEqual(ret[-1]['result'], 'Finished') +AssertionError: 'Failed' != 'Finished' +- Failed ++ Finished+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert.py", line 254, in test_convert_failed_and_email + select.select_by_visible_text('AZW3') + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/support/select.py", line 140, in select_by_visible_text + raise NoSuchElementException("Could not locate element with visible text: %s" % text) +selenium.common.exceptions.NoSuchElementException: Message: Could not locate element with visible text: AZW3+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert.py", line 622, in test_convert_options + self.assertEqual(from_book, set(['-- select an option --', "TXT"])) +AssertionError: Items in the first set but not the second: +'EPUB' +'AZW3'+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert.py", line 460, in test_email_only + self.assertEqual(ret[-1]['result'], 'Finished') +AssertionError: 'Failed' != 'Finished' +- Failed ++ Finished+
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert_gdrive.py", line 200, in test_convert_email - self.assertTrue("Convert" in ret[-2]['task']) -AssertionError: False is not true-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert_gdrive.py", line 330, in test_convert_only - self.assertEqual(ret[-6]['result'], 'Finished') + File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert_gdrive.py", line 226, in test_convert_email + self.assertEqual(ret[-1]['result'], 'Finished') AssertionError: 'Failed' != 'Finished' - Failed + Finished@@ -698,6 +748,46 @@ AssertionError: 'Failed' != 'Finished' +
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert_gdrive.py", line 244, in test_convert_failed_and_email + select.select_by_visible_text('AZW3') + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/support/select.py", line 140, in select_by_visible_text + raise NoSuchElementException("Could not locate element with visible text: %s" % text) +selenium.common.exceptions.NoSuchElementException: Message: Could not locate element with visible text: AZW3+
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert_gdrive.py", line 401, in test_email_only - self.assertTrue(self.check_element_on_page((By.ID, "flash_success"))) -AssertionError: False is not true-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert_gdrive.py", line 442, in test_thumbnail_cache - self.assertTrue(os.path.exists(thumbnail_cache_path)) -AssertionError: False is not true+ File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert_gdrive.py", line 460, in test_email_only + self.assertEqual(ret[-1]['result'], 'Finished') +AssertionError: 'Failed' != 'Finished' +- Failed ++ Finished
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert_kepubify.py", line 66, in test_convert_deactivate - self.assertFalse(details['kindlebtn']) -AssertionError: <selenium.webdriver.remote.webelement.WebElement (session="08f9d634-ab98-4b2a-8ef0-64104fea59e4", element="ccda4037-d63c-46e0-be4e-a8c7917f117f")> is not false-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert_kepubify.py", line 113, in test_convert_only - select = Select(vals['btn_from']) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/support/select.py", line 36, in __init__ - if webelement.tag_name.lower() != "select": -AttributeError: 'bool' object has no attribute 'tag_name'-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert_kepubify.py", line 82, in test_convert_wrong_excecutable - self.assertFalse(details['kindlebtn']) -AssertionError: <selenium.webdriver.remote.webelement.WebElement (session="08f9d634-ab98-4b2a-8ef0-64104fea59e4", element="57c8b86e-6bb9-454c-a20e-0e38c05bf281")> is not false-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert_kepubify_gdrive.py", line 114, in test_convert_deactivate - self.assertFalse(details['kindlebtn']) -AssertionError: <selenium.webdriver.remote.webelement.WebElement (session="7761912c-cf57-49f4-88d0-faf36b22e36c", element="2c9a3a10-07d0-4d04-a5a0-ee09f0f3d0a5")> is not false-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert_kepubify_gdrive.py", line 159, in test_convert_only - select = Select(vals['btn_from']) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/support/select.py", line 36, in __init__ - if webelement.tag_name.lower() != "select": -AttributeError: 'bool' object has no attribute 'tag_name'-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert_kepubify_gdrive.py", line 129, in test_convert_wrong_excecutable - self.assertFalse(details['kindlebtn']) -AssertionError: <selenium.webdriver.remote.webelement.WebElement (session="7761912c-cf57-49f4-88d0-faf36b22e36c", element="6425825b-eacd-4b24-8a86-84bd729786dc")> is not false-
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_ebooks_gdrive.py", line 185, in test_edit_title + self.assertEqual('The camicdemo', books[1][8]['title']) +IndexError: list index out of range+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_email_STARTTLS.py", line 81, in test_STARTTLS + self.assertEqual(ret[-1]['result'], 'Finished') +AssertionError: 'Failed' != 'Finished' +- Failed ++ Finished+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_email_STARTTLS.py", line 113, in test_STARTTLS_resend_password + self.assertTrue(wait_Email_received(self.email_server.handler.check_email_received)) +AssertionError: False is not true+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_email_STARTTLS.py", line 54, in tearDownClass + cls.stop_calibre_web() + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 475, in stop_calibre_web + cls.driver.find_element(By.ID, 'admin_stop').click() + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 1248, in find_element + return self.execute(Command.FIND_ELEMENT, { + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 425, in execute + self.error_handler.check_response(response) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response + raise exception_class(message, screen, stacktrace) +selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [id="admin_stop"] +Stacktrace: +WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:183:5 +NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.jsm:395:5 +element.find/</<@chrome://remote/content/marionette/element.js:300:16+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_email_ssl.py", line 52, in tearDownClass + cls.stop_calibre_web() + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 475, in stop_calibre_web + cls.driver.find_element(By.ID, 'admin_stop').click() + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 1248, in find_element + return self.execute(Command.FIND_ELEMENT, { + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 425, in execute + self.error_handler.check_response(response) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response + raise exception_class(message, screen, stacktrace) +selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [id="admin_stop"] +Stacktrace: +WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:183:5 +NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.jsm:395:5 +element.find/</<@chrome://remote/content/marionette/element.js:300:16+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_email_ssl.py", line 130, in test_SSL_logging_email + self.assertTrue(len(re.findall('Subject: Calibre-Web test e-mail', data)), "Email logging not working") +AssertionError: 0 is not true : Email logging not working+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_email_ssl.py", line 196, in test_SSL_non_admin_user + self.assertEqual(ret[-1]['result'], 'Finished') +AssertionError: 'Failed' != 'Finished' +- Failed ++ Finished+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_email_ssl.py", line 64, in test_SSL_only + self.setup_server(False, {'mail_use_ssl': 'SSL/TLS'}) + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 722, in setup_server + select = Select(cls.driver.find_element(By.ID, key)) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 1248, in find_element + return self.execute(Command.FIND_ELEMENT, { + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 425, in execute + self.error_handler.check_response(response) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response + raise exception_class(message, screen, stacktrace) +selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [id="mail_use_ssl"] +Stacktrace: +WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:183:5 +NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.jsm:395:5 +element.find/</<@chrome://remote/content/marionette/element.js:300:16+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_email_ssl.py", line 135, in test_email_limit + self.fill_basic_config({'config_uploading': 1}) + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 387, in fill_basic_config + cls._fill_basic_config(elements) + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 297, in _fill_basic_config + WebDriverWait(cls.driver, 5).until(EC.presence_of_element_located((By.ID, "config_port"))) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/support/wait.py", line 89, in until + raise TimeoutException(message, screen, stacktrace) +selenium.common.exceptions.TimeoutException: Message: +Stacktrace: +WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:183:5 +NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.jsm:395:5 +element.find/</<@chrome://remote/content/marionette/element.js:300:16+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_email_ssl.py", line 217, in test_filepicker_two_file + accordions[0].click() +IndexError: list index out of range+