mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Change the following to replace Python 2 code with Python 3:
1) Replace the deprecated unit test method. 2) Wraps filter usage in a list call. 3) Converts the old metaclass syntax to new. 4) Use range instead of xrange method. 5) Change Unicode to str. 6) Several other transformations. 7) Fixed change password test cases. 8) Use simplejson instead of plain JSON.
This commit is contained in:
committed by
Akshay Joshi
parent
11d5613866
commit
5a253f9053
@@ -16,7 +16,7 @@ import getpass
|
||||
|
||||
|
||||
def user_info_desktop():
|
||||
print(u"NOTE: Configuring authentication for DESKTOP mode.")
|
||||
print("NOTE: Configuring authentication for DESKTOP mode.")
|
||||
email = config.DESKTOP_USER
|
||||
p1 = ''.join([
|
||||
random.choice(string.ascii_letters + string.digits)
|
||||
@@ -26,7 +26,7 @@ def user_info_desktop():
|
||||
|
||||
|
||||
def user_info_server():
|
||||
print(u"NOTE: Configuring authentication for SERVER mode.\n")
|
||||
print("NOTE: Configuring authentication for SERVER mode.\n")
|
||||
|
||||
if all(value in os.environ for value in
|
||||
['PGADMIN_SETUP_EMAIL', 'PGADMIN_SETUP_PASSWORD']):
|
||||
@@ -39,8 +39,8 @@ def user_info_server():
|
||||
else:
|
||||
# Prompt the user for their default username and password.
|
||||
print(
|
||||
u"Enter the email address and password to use for the initial "
|
||||
u"pgAdmin user account:\n"
|
||||
"Enter the email address and password to use for the initial "
|
||||
"pgAdmin user account:\n"
|
||||
)
|
||||
|
||||
email_filter = re.compile(
|
||||
@@ -51,7 +51,7 @@ def user_info_server():
|
||||
|
||||
email = input("Email address: ")
|
||||
while email == '' or not email_filter.match(email):
|
||||
print(u'Invalid email address. Please try again.')
|
||||
print('Invalid email address. Please try again.')
|
||||
email = input("Email address: ")
|
||||
|
||||
def pprompt():
|
||||
@@ -60,11 +60,11 @@ def user_info_server():
|
||||
p1, p2 = pprompt()
|
||||
while p1 != p2 or len(p1) < 6:
|
||||
if p1 != p2:
|
||||
print(u'Passwords do not match. Please try again.')
|
||||
print('Passwords do not match. Please try again.')
|
||||
else:
|
||||
print(
|
||||
u'Password must be at least 6 characters. '
|
||||
u'Please try again.'
|
||||
'Password must be at least 6 characters. '
|
||||
'Please try again.'
|
||||
)
|
||||
p1, p2 = pprompt()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user