diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ce2bd780..c6006ad1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,6 +41,6 @@ Open a new GitHub pull request with the patch. Ensure the PR description clearly In case your code enhances features of Calibre-Web: Create your pull request for the development branch if your enhancement consists of more than some lines of code in a local section of Calibre-Webs code. This makes it easier to test it and check all implication before it's made public. -Please check if your code runs on Python 2.7 (still necessary in 2020) and mainly on python 3. If possible and the feature is related to operating system functions, try to check it on Windows and Linux. -Calibre-Web is automatically tested on Linux in combination with python 3.7. The code for testing is in a [separate repo](https://github.com/OzzieIsaacs/calibre-web-test) on Github. It uses unit tests and performs real system tests with selenium; it would be great if you could consider also writing some tests. +Please check if your code runs with python 3, python 2 is no longer supported. If possible and the feature is related to operating system functions, try to check it on Windows and Linux. +Calibre-Web is automatically tested on Linux in combination with python 3.8. The code for testing is in a [separate repo](https://github.com/OzzieIsaacs/calibre-web-test) on Github. It uses unit tests and performs real system tests with selenium; it would be great if you could consider also writing some tests. A static code analysis is done by Codacy, but it's partly broken and doesn't run automatically. You could check your code with ESLint before contributing, a configuration file can be found in the projects root folder. diff --git a/cps/__init__.py b/cps/__init__.py index 3266a4e9..9b004640 100644 --- a/cps/__init__.py +++ b/cps/__init__.py @@ -102,8 +102,9 @@ def create_app(): log.info('Starting Calibre Web...') if sys.version_info < (3, 0): - log.info('Python2 is EOL since end of 2019, this version of Calibre-Web is no longer supporting Python2 please consider upgrading to Python3') - print('Python2 is EOL since end of 2019, this version of Calibre-Web is no longer supporting Python2 please consider upgrading to Python3') + log.info('*** Python2 is EOL since end of 2019, this version of Calibre-Web is no longer supporting Python2, please update your installation to Python3 ***') + print('*** Python2 is EOL since end of 2019, this version of Calibre-Web is no longer supporting Python2, please update your installation to Python3 ***') + sys.exit(5) Principal(app) lm.init_app(app) app.secret_key = os.getenv('SECRET_KEY', config_sql.get_flask_session_key(ub.session)) diff --git a/cps/converter.py b/cps/converter.py index f37168c7..6b0f22e4 100644 --- a/cps/converter.py +++ b/cps/converter.py @@ -39,7 +39,9 @@ def _get_command_version(path, pattern, argument=None): if argument: command.append(argument) try: - return process_wait(command, pattern=pattern).string + match = process_wait(command, pattern=pattern) + if isinstance(match, re.Match): + return match.string except Exception as ex: log.warning("%s: %s", path, ex) return _EXECUTION_ERROR diff --git a/cps/templates/config_db.html b/cps/templates/config_db.html index 0d1d1bce..e0e1bfd1 100644 --- a/cps/templates/config_db.html +++ b/cps/templates/config_db.html @@ -20,7 +20,7 @@ - {% if not gdriveError %} + {% if not gdriveError and config.config_use_google_drive %} {% if show_authenticate_google_drive and config.config_use_google_drive %}
Start Time: 2021-05-27 20:44:36
+Start Time: 2021-07-29 20:37:20
Stop Time: 2021-05-28 00:00:32
+Stop Time: 2021-07-30 00:10:27
Duration: 2h 37 min
+Duration: 2h 47 min
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_cli.py", line 442, in test_change_password + self.assertTrue(self.login("admin", "@hukl")) +AssertionError: False is not true+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_cli.py", line 278, in test_cli_SSL_files + self.driver.get("https://127.0.0.1:8083") +selenium.common.exceptions.WebDriverException: Message: Reached error page: about:neterror?e=netTimeout&u=https%3A//127.0.0.1%3A8083/&c=UTF-8&d=Der%20Server%20unter%20127.0.0.1%20braucht%20zu%20lange%2C%20um%20eine%20Antwort%20zu%20senden. + + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_cli.py", line 280, in test_cli_SSL_files + self.assertIsNone("Error", "HTTPS Connection could not established with key/cert file") +AssertionError: 'Error' is not None : HTTPS Connection could not established with key/cert file+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_cli.py", line 121, in test_cli_different_settings_database + self.fill_db_config({'config_calibre_dir': TEST_DB}) + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 243, in fill_db_config + ele = 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 360, in find_element_by_id + return self.find_element(by=By.ID, value=id_) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 976, 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 321, 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 242, in check_response + raise exception_class(message, screen, stacktrace) +selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [id="config_calibre_dir"]+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_cli.py", line 393, in test_settingsdb_not_writeable + self.fill_db_config({'config_calibre_dir': TEST_DB}) +selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [id="config_calibre_dir"] + + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_cli.py", line 398, in test_settingsdb_not_writeable + self.assertFalse(True, "Inital config failed with on test nonwriteable database") +AssertionError: True is not false : Inital config failed with on test nonwriteable database+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_cli_gdrive.py", line 180, in test_cli_gdrive_location + 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_cli_gdrive.py", line 145, in test_gdrive_db_nonwrite + self.start_cw(os.path.join(CALIBRE_WEB_PATH, u'cps.py')) + File "/home/ozzie/Development/calibre-web-test/test/test_cli_gdrive.py", line 137, in start_cw + self.fill_db_config({'config_calibre_dir': TEST_DB}) + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 248, in fill_db_config + cls.driver.find_element_by_name("submit").click() + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py", line 80, in click + self._execute(Command.CLICK_ELEMENT) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py", line 633, in _execute + return self._parent.execute(command, params) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, 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 242, in check_response + raise exception_class(message, screen, stacktrace) +selenium.common.exceptions.WebDriverException: Message: Reached error page: about:neterror?e=netReset&u=http%3A//127.0.0.1%3A8083/admin/dbconfig&c=UTF-8&d=Die%20Verbindung%20zum%20Server%20wurde%20zur%C3%BCckgesetzt%2C%20w%C3%A4hrend%20die%20Seite%20geladen%20wurde.+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert.py", line 94, in test_convert_wrong_excecutable + self.assertEqual(element.text, 'not installed') +AssertionError: 'Execution permissions missing' != 'not installed' +- Execution permissions missing ++ not installed+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_ebook_convert.py", line 416, 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/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen + httplib_response = self._make_request( + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 426, in _make_request + six.raise_from(e, None) + File "+", line 3, in raise_from + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 421, in _make_request + httplib_response = conn.getresponse() + File "/usr/lib/python3.8/http/client.py", line 1344, in getresponse + response.begin() + File "/usr/lib/python3.8/http/client.py", line 307, in begin + version, status, reason = self._read_status() + File "/usr/lib/python3.8/http/client.py", line 276, in _read_status + raise RemoteDisconnected("Remote end closed connection without" +http.client.RemoteDisconnected: Remote end closed connection without response + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/requests/adapters.py", line 439, in send + resp = conn.urlopen( + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 726, in urlopen + retries = retries.increment( + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/urllib3/util/retry.py", line 410, in increment + raise six.reraise(type(error), error, _stacktrace) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/urllib3/packages/six.py", line 734, in reraise + raise value.with_traceback(tb) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen + httplib_response = self._make_request( + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 426, in _make_request + six.raise_from(e, None) + File " ", line 3, in raise_from + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 421, in _make_request + httplib_response = conn.getresponse() + File "/usr/lib/python3.8/http/client.py", line 1344, in getresponse + response.begin() + File "/usr/lib/python3.8/http/client.py", line 307, in begin + version, status, reason = self._read_status() + File "/usr/lib/python3.8/http/client.py", line 276, in _read_status + raise RemoteDisconnected("Remote end closed connection without" +urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_additional_books.py", line 564, in test_upload_edit_role + r.post('http://127.0.0.1:8083/login', data=payload) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/requests/sessions.py", line 578, in post + return self.request('POST', url, data=data, json=json, **kwargs) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/requests/sessions.py", line 530, in request + resp = self.send(prep, **send_kwargs) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/requests/sessions.py", line 665, in send + history = [resp for resp in gen] + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/requests/sessions.py", line 665, in + history = [resp for resp in gen] + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/requests/sessions.py", line 237, in resolve_redirects + resp = self.send( + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/requests/sessions.py", line 643, in send + r = adapter.send(request, **kwargs) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/requests/adapters.py", line 498, in send + raise ConnectionError(err, request=request) +requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_additional_books.py", line 53, in test_upload_metadata_cbr + self.fill_basic_config({'config_uploading': 1}) + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 342, in fill_basic_config + cls._fill_basic_config(elements) + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 252, 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 80, in until + raise TimeoutException(message, screen, stacktrace) +selenium.common.exceptions.TimeoutException: Message:+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_additional_books.py", line 88, in test_upload_metadata_cbt + self.fill_basic_config({'config_uploading': 1}) + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 342, in fill_basic_config + cls._fill_basic_config(elements) + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 252, 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 80, in until + raise TimeoutException(message, screen, stacktrace) +selenium.common.exceptions.TimeoutException: Message:+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_additional_books.py", line 234, in test_writeonly_path + self.fill_basic_config({'config_rarfile_location': unrar_path()}) + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 342, in fill_basic_config + cls._fill_basic_config(elements) + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 252, 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 80, in until + raise TimeoutException(message, screen, stacktrace) +selenium.common.exceptions.TimeoutException: Message:+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_additional_books.py", line 39, in tearDownClass + cls.stop_calibre_web() + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 430, 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 360, in find_element_by_id + return self.find_element(by=By.ID, value=id_) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 976, 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 321, 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 242, in check_response + raise exception_class(message, screen, stacktrace) +selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [id="admin_stop"]+