[migration] mh.confirm support a new default argument, fix default handling for ASK
--- a/common/migration.py Fri Aug 07 14:49:48 2009 +0200
+++ b/common/migration.py Fri Aug 07 16:18:28 2009 +0200
@@ -183,12 +183,12 @@
if not ask_confirm or self.confirm(msg):
return meth(*args, **kwargs)
- def confirm(self, question, shell=True, abort=True, retry=False):
+ def confirm(self, question, shell=True, abort=True, retry=False, default='y'):
"""ask for confirmation and return true on positive answer
if `retry` is true the r[etry] answer may return 2
"""
- possibleanswers = ['Y','n']
+ possibleanswers = ['y','n']
if abort:
possibleanswers.append('abort')
if shell:
@@ -196,7 +196,7 @@
if retry:
possibleanswers.append('retry')
try:
- answer = ASK.ask(question, possibleanswers, 'Y')
+ answer = ASK.ask(question, possibleanswers, default)
except (EOFError, KeyboardInterrupt):
answer = 'abort'
if answer == 'n':