From f66bd4bcfbd4b24739ecc4be9f2d6a2e689d3651 Mon Sep 17 00:00:00 2001 From: Khushboo Vashi Date: Wed, 5 Jun 2024 14:11:59 +0530 Subject: [PATCH] Remove the use of is_normalized function for Python 3.7. --- web/pgadmin/tools/user_management/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/pgadmin/tools/user_management/__init__.py b/web/pgadmin/tools/user_management/__init__.py index cd24fe9bb..15fc4ba1d 100644 --- a/web/pgadmin/tools/user_management/__init__.py +++ b/web/pgadmin/tools/user_management/__init__.py @@ -10,7 +10,11 @@ """Implements pgAdmin4 User Management Utility""" 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 from flask_babel import gettext as _ @@ -442,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)