prompts: fixed input() calls for python3

This commit is contained in:
RhodeCode Admin 2023-08-25 12:51:20 +02:00
parent 3424f9c3fc
commit 920327d224
3 changed files with 6 additions and 7 deletions

View file

@ -276,7 +276,7 @@ class DbManage(object):
email = defaults.get('email') email = defaults.get('email')
if username is None: if username is None:
username = eval(input('Specify admin username:')) username = input('Specify admin username:')
if password is None: if password is None:
password = self._get_admin_password() password = self._get_admin_password()
if not password: if not password:
@ -285,7 +285,7 @@ class DbManage(object):
if not password: if not password:
sys.exit() sys.exit()
if email is None: if email is None:
email = eval(input('Specify admin email:')) email = input('Specify admin email:')
api_key = self.cli_args.get('api_key') api_key = self.cli_args.get('api_key')
self.create_user(username, password, email, True, self.create_user(username, password, email, True,
strict_creation_check=False, strict_creation_check=False,
@ -524,10 +524,10 @@ class DbManage(object):
if _path is not None: if _path is not None:
path = _path path = _path
elif not self.tests and not test_repo_path: elif not self.tests and not test_repo_path:
path = eval(input( path = input(
'Enter a valid absolute path to store repositories. ' 'Enter a valid absolute path to store repositories. '
'All repositories in that path will be added automatically:' 'All repositories in that path will be added automatically:'
)) )
else: else:
path = test_repo_path path = test_repo_path
path_ok = True path_ok = True

View file

@ -17,7 +17,6 @@ from zope.interface import implementer
from binascii import hexlify from binascii import hexlify
class CustomSession(Session): class CustomSession(Session):
pass pass
@ -109,7 +108,7 @@ def BeakerSessionFactoryConfig(**options):
return storage return storage
def peek_flash(self, queue=''): def peek_flash(self, queue=''):
storage = self.get('_f_' + queue, []) storage = self.get(f'_f_{queue}', [])
return storage return storage
# CSRF API methods # CSRF API methods

View file

@ -321,7 +321,7 @@ def is_valid_repo_group(repo_group_name, base_path, skip_path_check=False):
def ask_ok(prompt, retries=4, complaint='[y]es or [n]o please!'): def ask_ok(prompt, retries=4, complaint='[y]es or [n]o please!'):
while True: while True:
ok = eval(input(prompt)) ok = input(prompt)
if ok.lower() in ('y', 'ye', 'yes'): if ok.lower() in ('y', 'ye', 'yes'):
return True return True
if ok.lower() in ('n', 'no', 'nop', 'nope'): if ok.lower() in ('n', 'no', 'nop', 'nope'):