Revert the changes done for removing support for Python 3.7

This commit is contained in:
Aditya Toshniwal 2024-06-12 16:23:27 +05:30
parent 6357672387
commit 056aff4742
8 changed files with 50 additions and 21 deletions

View File

@ -19,6 +19,7 @@ Bundled PostgreSQL Utilities
New features New features
************ ************
| `Issue #5932 <https://github.com/pgadmin-org/pgadmin4/issues/5932>`_ - Provide option to set theme based on OS theme preference.
Housekeeping Housekeeping
@ -32,3 +33,4 @@ Bug fixes
| `Issue #6357 <https://github.com/pgadmin-org/pgadmin4/issues/6357>`_ - Disable the query tool editor input if any SQL is being loaded to prevent users from typing. | `Issue #6357 <https://github.com/pgadmin-org/pgadmin4/issues/6357>`_ - Disable the query tool editor input if any SQL is being loaded to prevent users from typing.
| `Issue #7306 <https://github.com/pgadmin-org/pgadmin4/issues/7306>`_ - Ensure that a user can connect to a server using SSL certificates and identity files from a shared storage. | `Issue #7306 <https://github.com/pgadmin-org/pgadmin4/issues/7306>`_ - Ensure that a user can connect to a server using SSL certificates and identity files from a shared storage.
| `Issue #7481 <https://github.com/pgadmin-org/pgadmin4/issues/7481>`_ - Fixed an issue where dark theme shows white background when all tabs are closed. | `Issue #7481 <https://github.com/pgadmin-org/pgadmin4/issues/7481>`_ - Fixed an issue where dark theme shows white background when all tabs are closed.
| `Issue #7516 <https://github.com/pgadmin-org/pgadmin4/issues/7516>`_ - Ensure preferences can be loaded using preferences.json.

View File

@ -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-Login==0.*
Flask-Mail==0.* Flask-Mail==0.*
Flask-Migrate==4.* Flask-Migrate==4.*
greenlet==1.1.2; python_version <= '3.10' greenlet==1.1.2; python_version <= '3.10'
Flask-SQLAlchemy==3.1.* Flask-SQLAlchemy==3.1.*; python_version > '3.7'
Flask-WTF==1.2.* 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-Compress==1.*
Flask-Paranoid==0.* Flask-Paranoid==0.*
Flask-Babel==4.0.* Flask-Babel==4.0.*; python_version > '3.7'
Flask-Security-Too==5.4.* 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.* Flask-SocketIO==5.3.*
WTForms==3.1.* WTForms==3.1.*; python_version > '3.7'
WTForms==3.0.*; python_version <= '3.7'
passlib==1.* passlib==1.*
pytz==2024.* pytz==2024.*
speaklater3==1.* speaklater3==1.*
@ -38,7 +44,8 @@ eventlet==0.36.1
httpagentparser==1.9.* httpagentparser==1.9.*
user-agents==2.2.0 user-agents==2.2.0
pywinpty==2.0.*; sys_platform=="win32" 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.* pyotp==2.*
qrcode==7.* qrcode==7.*
boto3==1.34.* boto3==1.34.*
@ -49,8 +56,10 @@ azure-mgmt-subscription==3.1.1
azure-identity==1.16.1 azure-identity==1.16.1
google-api-python-client==2.* google-api-python-client==2.*
google-auth-oauthlib==1.2.0 google-auth-oauthlib==1.2.0
keyring==24.* keyring==24.*; python_version > '3.7'
Werkzeug==3.0.* 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.* typer[all]==0.12.*
setuptools==70.*; python_version >= '3.12' setuptools==70.*; python_version >= '3.12'
jsonformatter~=0.3.2 jsonformatter~=0.3.2

View File

@ -15,8 +15,8 @@ import sys
if sys.version_info <= (3, 9): if sys.version_info <= (3, 9):
import select import select
if sys.version_info < (3, 4): if sys.version_info < (3, 7):
raise RuntimeError('This application must be run under Python 3.4 ' raise RuntimeError('This application must be run under Python 3.7 '
'or later.') 'or later.')
import builtins import builtins
import os import os

View File

@ -10,8 +10,8 @@
import os import os
import sys import sys
if sys.version_info < (3, 8): if sys.version_info < (3, 7):
raise Exception('This application must be run under Python 3.8 or later.') raise Exception('This application must be run under Python 3.7 or later.')
import builtins import builtins

View File

@ -520,9 +520,13 @@ def create_app(app_name=None):
security.init_app(app, user_datastore) security.init_app(app, user_datastore)
# Flask-Security-Too > 5.4.* requires custom unauthn handler # register custom unauthorised handler.
# to be registered with it. if sys.version_info < (3, 8):
security.unauthn_handler(pga_unauthorised) 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. # Set the permanent session lifetime to the specified value in config file.
app.permanent_session_lifetime = timedelta( app.permanent_session_lifetime = timedelta(

View File

@ -65,7 +65,13 @@ from pgadmin.authenticate import AuthSourceManager
from pgadmin.utils.exception import CryptKeyMissing from pgadmin.utils.exception import CryptKeyMissing
from pgadmin.user_login_check import pga_login_required 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' MODULE_NAME = 'browser'
BROWSER_STATIC = 'browser.static' BROWSER_STATIC = 'browser.static'
@ -1101,7 +1107,9 @@ if hasattr(config, 'SECURITY_RECOVERABLE') and config.SECURITY_RECOVERABLE:
has_error = False has_error = False
form_class = _security.forms.get('reset_password_form').cls form_class = _security.forms.get('reset_password_form').cls
form = form_class(request.form) if request.form else form_class() 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(): if form.validate_on_submit():
try: try:

View File

@ -11,7 +11,9 @@
import json 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, \ from flask import render_template, request, \
Response, abort, current_app, session Response, abort, current_app, session
@ -444,6 +446,10 @@ def normalise_password(password):
'NFKD' '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\ return password if is_normalized(normalise_form, password) else\
normalize(normalise_form, password) normalize(normalise_form, password)

View File

@ -29,8 +29,8 @@ from selenium.webdriver.firefox.options import Options as FirefoxOptions
if sys.platform == "win32": if sys.platform == "win32":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
if sys.version_info < (3, 4): if sys.version_info < (3, 7):
raise RuntimeError('The test suite must be run under Python 3.4 or later.') raise RuntimeError('The test suite must be run under Python 3.7 or later.')
import builtins import builtins