jenkins-bot has submitted this change and it was merged.
Change subject: (bugfix) compare the default key in the right order ......................................................................
(bugfix) compare the default key in the right order
if default key exist and answer is an empty string, the default value must be returned. Return the choice if it is in hotkeys. Otherwise try again.
With this patch the keys may be given as list or tuple or also as string which simplifies the code. Because '' in 'anystring' is always True the old order didn't work for hotkeys string.
Change-Id: I2caddf213818de231a3258b3a00cca0f6e51b268 --- M pywikibot/userinterfaces/terminal_interface_base.py 1 file changed, 3 insertions(+), 3 deletions(-)
Approvals: Ladsgroup: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py b/pywikibot/userinterfaces/terminal_interface_base.py index 927ec13..745aa26 100755 --- a/pywikibot/userinterfaces/terminal_interface_base.py +++ b/pywikibot/userinterfaces/terminal_interface_base.py @@ -217,10 +217,10 @@ while True: prompt = '%s (%s)' % (question, ', '.join(options)) answer = self.input(prompt) - if answer.lower() in hotkeys or answer.upper() in hotkeys: - return answer - elif default and answer == '': # empty string entered + if default and answer == '': # empty string entered return default + elif answer.lower() in hotkeys or answer.upper() in hotkeys: + return answer
def editText(self, text, jumpIndex=None, highlight=None): """Return the text as edited by the user.
pywikibot-commits@lists.wikimedia.org