greater flexibility for --batch when default is None

This commit is contained in:
Miroslav Stampar 2011-04-08 22:29:50 +00:00
parent 6fa2fd139c
commit 83feb097ef
2 changed files with 5 additions and 3 deletions

View File

@ -679,11 +679,13 @@ def readInput(message, default=None):
elif message[-1] == ']': elif message[-1] == ']':
message += " " message += " "
if conf.batch and default is not None: if conf.batch:
if isinstance(default, (list, tuple, set)): if isinstance(default, (list, tuple, set)):
options = ",".join([getUnicode(opt, UNICODE_ENCODING) for opt in default]) options = ",".join([getUnicode(opt, UNICODE_ENCODING) for opt in default])
else: elif default:
options = getUnicode(default, UNICODE_ENCODING) options = getUnicode(default, UNICODE_ENCODING)
else:
options = unicode()
infoMsg = "%s%s" % (message, options) infoMsg = "%s%s" % (message, options)
logger.info(infoMsg) logger.info(infoMsg)

View File

@ -232,7 +232,7 @@ class Connect:
msg += "also on the redirection got from the application\n" msg += "also on the redirection got from the application\n"
while True: while True:
choice = readInput(msg, default="") choice = readInput(msg, default=None)
if not choice: if not choice:
pass pass