Revision: 4299
Author: leogregianin
Date: 2007-09-15 19:23:22 +0000 (Sat, 15 Sep 2007)
choice2 =
wikipedia.inputChoice(u'Change the page title
to "%s"?' % newPageTitle, ['yes', 'no', 'all',
'quit'],
['y', 'n', 'a', 'q'])
(...)
- elif choice2 == 'n':
+ elif choice2 in ['n', 'N', 'no']:
from terminal_interface.py:
if answer.lower() in hotkeys or answer.upper() in hotkeys:
return answer
elif default and answer=='': # empty string entered
return default
What's the point of the 'no', as it should never be returned?
On a side note; does anyone have suggestions for the inputChoice format?
Is the current inputChoice(text, choices, keys, default) the preferred
one, and is the 'N' or 'n' output the preferred one?
For the i18n branch, I have thought of several possibilities:
For the function call:
* inputChoice(text, subst, choices, keys, default)
i.e.: inputChoice("Save %s", page.aslink(), ['yes','no'],
['y','n'], 'y')
* inputChoice(text, subst, choiceskeys, default)
i.e.: inputChoice("Save %s", page.aslink(), [('yes',
'y'),('no','n')],
'y')
* inputChoice(text, subst, choiceskeys) (caps means default)
i.e.: inputChoice("Save %s", page.aslink(), [('yes',
'Y'),('no','n')])
* inputChoice(text, subst, choiceskeys) (triple tuple means default)
i.e.: inputChoice("Save %s", page.aslink(), [('yes', 'y',
default),('no','n')]) (with default a variable)
For the return value (which will always be the english values):
'Y' or 'y', depending on the entered caps (current system)
'Y'; 'y', always lower or upper case
'yes', the text used
Because the i18n branch introduces breaking changes anyway, this might be
a good moment to sort this out. Please comment :)
--valhallasw