mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Use six.moves.input instead of raw_input
In Python 3, raw_input() was renamed to input(). Import the function from six.moves to get the right version. Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
parent
5a9141dc40
commit
c27cb295a5
@ -33,6 +33,7 @@ import base64
|
||||
import traceback
|
||||
|
||||
import six
|
||||
from six.moves import input
|
||||
|
||||
try:
|
||||
#pylint: disable=F0401
|
||||
@ -527,7 +528,7 @@ class textui(backend.Backend):
|
||||
def print_error(self, text):
|
||||
print ' ** %s **' % unicode(text)
|
||||
|
||||
def prompt_helper(self, prompt, label, prompt_func=raw_input):
|
||||
def prompt_helper(self, prompt, label, prompt_func=input):
|
||||
"""Prompt user for input
|
||||
|
||||
Handles encoding the prompt and decoding the input.
|
||||
|
@ -42,6 +42,7 @@ from contextlib import contextmanager
|
||||
from dns import resolver, rdatatype
|
||||
from dns.exception import DNSException
|
||||
import six
|
||||
from six.moves import input
|
||||
|
||||
from ipapython.ipa_log_manager import *
|
||||
from ipapython import ipavalidate
|
||||
@ -764,7 +765,7 @@ def user_input(prompt, default = None, allow_empty = True):
|
||||
if default == None:
|
||||
while True:
|
||||
try:
|
||||
ret = raw_input("%s: " % prompt)
|
||||
ret = input("%s: " % prompt)
|
||||
if allow_empty or ret.strip():
|
||||
return ret
|
||||
except EOFError:
|
||||
@ -775,7 +776,7 @@ def user_input(prompt, default = None, allow_empty = True):
|
||||
if isinstance(default, six.string_types):
|
||||
while True:
|
||||
try:
|
||||
ret = raw_input("%s [%s]: " % (prompt, default))
|
||||
ret = input("%s [%s]: " % (prompt, default))
|
||||
if not ret and (allow_empty or default):
|
||||
return default
|
||||
elif ret.strip():
|
||||
@ -787,7 +788,7 @@ def user_input(prompt, default = None, allow_empty = True):
|
||||
choice = "yes" if default else "no"
|
||||
while True:
|
||||
try:
|
||||
ret = raw_input("%s [%s]: " % (prompt, choice))
|
||||
ret = input("%s [%s]: " % (prompt, choice))
|
||||
if not ret:
|
||||
return default
|
||||
elif ret.lower()[0] == "y":
|
||||
@ -800,7 +801,7 @@ def user_input(prompt, default = None, allow_empty = True):
|
||||
if isinstance(default, int):
|
||||
while True:
|
||||
try:
|
||||
ret = raw_input("%s [%s]: " % (prompt, default))
|
||||
ret = input("%s [%s]: " % (prompt, default))
|
||||
if not ret:
|
||||
return default
|
||||
ret = int(ret)
|
||||
|
Loading…
Reference in New Issue
Block a user