diff --git a/docs/en_US/release_notes_8_9.rst b/docs/en_US/release_notes_8_9.rst index b78cd6c52..0a12d372d 100644 --- a/docs/en_US/release_notes_8_9.rst +++ b/docs/en_US/release_notes_8_9.rst @@ -19,6 +19,7 @@ Bundled PostgreSQL Utilities New features ************ + | `Issue #5932 `_ - Provide option to set theme based on OS theme preference. Housekeeping @@ -32,3 +33,4 @@ Bug fixes | `Issue #6357 `_ - Disable the query tool editor input if any SQL is being loaded to prevent users from typing. | `Issue #7306 `_ - Ensure that a user can connect to a server using SSL certificates and identity files from a shared storage. | `Issue #7481 `_ - Fixed an issue where dark theme shows white background when all tabs are closed. + | `Issue #7516 `_ - Ensure preferences can be loaded using preferences.json. diff --git a/requirements.txt b/requirements.txt index d56bf8082..5df6538f0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,19 +8,25 @@ # ############################################################################### -Flask==3.0.* +Flask==3.0.*; python_version > '3.7' +Flask==2.2.*; python_version <= '3.7' Flask-Login==0.* Flask-Mail==0.* Flask-Migrate==4.* greenlet==1.1.2; python_version <= '3.10' -Flask-SQLAlchemy==3.1.* -Flask-WTF==1.2.* +Flask-SQLAlchemy==3.1.*; python_version > '3.7' +Flask-SQLAlchemy==3.0.*; python_version <= '3.7' +Flask-WTF==1.2.*; python_version > '3.7' +Flask-WTF==1.1.1; python_version <= '3.7' Flask-Compress==1.* Flask-Paranoid==0.* -Flask-Babel==4.0.* -Flask-Security-Too==5.4.* +Flask-Babel==4.0.*; python_version > '3.7' +Flask-Babel==3.1.*; python_version <= '3.7' +Flask-Security-Too==5.4.*; python_version > '3.7' +Flask-Security-Too==5.1.*; python_version <= '3.7' Flask-SocketIO==5.3.* -WTForms==3.1.* +WTForms==3.1.*; python_version > '3.7' +WTForms==3.0.*; python_version <= '3.7' passlib==1.* pytz==2024.* speaklater3==1.* @@ -38,7 +44,8 @@ eventlet==0.36.1 httpagentparser==1.9.* user-agents==2.2.0 pywinpty==2.0.*; sys_platform=="win32" -Authlib==1.3.* +Authlib==1.3.*; python_version > '3.7' +Authlib==1.2.*; python_version <= '3.7' pyotp==2.* qrcode==7.* boto3==1.34.* @@ -49,8 +56,10 @@ azure-mgmt-subscription==3.1.1 azure-identity==1.16.1 google-api-python-client==2.* google-auth-oauthlib==1.2.0 -keyring==24.* -Werkzeug==3.0.* +keyring==24.*; python_version > '3.7' +keyring==23.*; python_version <= '3.7' +Werkzeug==3.0.*; python_version > '3.7' +Werkzeug==2.2.3; python_version <= '3.7' typer[all]==0.12.* setuptools==70.*; python_version >= '3.12' jsonformatter~=0.3.2 diff --git a/web/pgAdmin4.py b/web/pgAdmin4.py index b9062c80e..5adbb0c48 100644 --- a/web/pgAdmin4.py +++ b/web/pgAdmin4.py @@ -15,8 +15,8 @@ import sys if sys.version_info <= (3, 9): import select -if sys.version_info < (3, 4): - raise RuntimeError('This application must be run under Python 3.4 ' +if sys.version_info < (3, 7): + raise RuntimeError('This application must be run under Python 3.7 ' 'or later.') import builtins import os diff --git a/web/pgAdmin4.wsgi b/web/pgAdmin4.wsgi index ee521d700..9cce91ed4 100644 --- a/web/pgAdmin4.wsgi +++ b/web/pgAdmin4.wsgi @@ -10,8 +10,8 @@ import os import sys -if sys.version_info < (3, 8): - raise Exception('This application must be run under Python 3.8 or later.') +if sys.version_info < (3, 7): + raise Exception('This application must be run under Python 3.7 or later.') import builtins diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py index afd33e37d..49b8edbda 100644 --- a/web/pgadmin/__init__.py +++ b/web/pgadmin/__init__.py @@ -520,9 +520,13 @@ def create_app(app_name=None): security.init_app(app, user_datastore) - # Flask-Security-Too > 5.4.* requires custom unauthn handler - # to be registered with it. - security.unauthn_handler(pga_unauthorised) + # register custom unauthorised handler. + if sys.version_info < (3, 8): + app.login_manager.unauthorized_handler(pga_unauthorised) + else: + # Flask-Security-Too > 5.4.* requires custom unauth handeler + # to be registeres with it. + security.unauthn_handler(pga_unauthorised) # Set the permanent session lifetime to the specified value in config file. app.permanent_session_lifetime = timedelta( diff --git a/web/pgadmin/browser/__init__.py b/web/pgadmin/browser/__init__.py index 2ff828036..ac55234b6 100644 --- a/web/pgadmin/browser/__init__.py +++ b/web/pgadmin/browser/__init__.py @@ -65,7 +65,13 @@ from pgadmin.authenticate import AuthSourceManager from pgadmin.utils.exception import CryptKeyMissing from pgadmin.user_login_check import pga_login_required -from flask_security.views import default_render_json + +try: + from flask_security.views import default_render_json +except ImportError as e: + # Support Flask-Security-Too == 3.2 + if sys.version_info < (3, 8): + from flask_security.views import _render_json as default_render_json MODULE_NAME = 'browser' BROWSER_STATIC = 'browser.static' @@ -1101,7 +1107,9 @@ if hasattr(config, 'SECURITY_RECOVERABLE') and config.SECURITY_RECOVERABLE: has_error = False form_class = _security.forms.get('reset_password_form').cls form = form_class(request.form) if request.form else form_class() - form.user = user + + if sys.version_info >= (3, 8): + form.user = user if form.validate_on_submit(): try: diff --git a/web/pgadmin/tools/user_management/__init__.py b/web/pgadmin/tools/user_management/__init__.py index ee3999dd0..15fc4ba1d 100644 --- a/web/pgadmin/tools/user_management/__init__.py +++ b/web/pgadmin/tools/user_management/__init__.py @@ -11,7 +11,9 @@ import json -from unicodedata import normalize, is_normalized +import sys +if sys.version_info >= (3, 8): + from unicodedata import normalize, is_normalized from flask import render_template, request, \ Response, abort, current_app, session @@ -444,6 +446,10 @@ def normalise_password(password): 'NFKD' ) + # Remove check of Python version once Python 3.7 support ends + if sys.version_info < (3, 8): + return password + return password if is_normalized(normalise_form, password) else\ normalize(normalise_form, password) diff --git a/web/regression/runtests.py b/web/regression/runtests.py index ee714cefa..2fc560995 100644 --- a/web/regression/runtests.py +++ b/web/regression/runtests.py @@ -29,8 +29,8 @@ from selenium.webdriver.firefox.options import Options as FirefoxOptions if sys.platform == "win32": asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) -if sys.version_info < (3, 4): - raise RuntimeError('The test suite must be run under Python 3.4 or later.') +if sys.version_info < (3, 7): + raise RuntimeError('The test suite must be run under Python 3.7 or later.') import builtins