Ignore case in yes/no prompts

We did not accept answers like "Yes", "YES", "No", etc. as valid
answers to yes/no prompts (used for example in dnsrecord-del
interactive mode). This could confuse users. This patch changes
the behavior to ignore the answer case.

https://fedorahosted.org/freeipa/ticket/2484
This commit is contained in:
Martin Kosek 2012-03-07 18:51:04 +01:00
parent 536bcd2666
commit 480e1a098a

View File

@ -574,7 +574,7 @@ class textui(backend.Backend):
prompt = u'%s Yes/No: ' % label prompt = u'%s Yes/No: ' % label
while True: while True:
data = self.prompt_helper(prompt, label) data = self.prompt_helper(prompt, label).lower() #pylint: disable=E1103
if data in (u'yes', u'y'): if data in (u'yes', u'y'):
return True return True