mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Revert the changes done for removing support for Python 3.7
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user