python3: fixed raw-input

This commit is contained in:
RhodeCode Admin 2023-03-10 11:42:48 +01:00
parent c9bdedb3ea
commit c85d3ce02e
2 changed files with 6 additions and 5 deletions

View file

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

View file

@ -291,14 +291,15 @@ class _Page(list):
# wrapper class can execute a query with the knowledge of what the
# slice will be (for efficiency) and, in the same query, ask for the
# total number of items and only execute one query.
try:
first = (self.page - 1) * items_per_page
last = first + items_per_page
self.items = list(self.collection[first:last])
except TypeError as err:
raise TypeError(
"Your collection of type {} cannot be handled "
"by paginate. ERROR:{}".format(type(self.collection), err)
f"Your collection of type {type(self.collection)} cannot be handled "
f"by paginate. ERROR:{err}"
)
# Unless the user tells us how many items the collections has