summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-14 11:58:01 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-14 11:58:01 +0100
commit63617be06a287fcba675d736eb20cbc2ec183539 (patch)
tree1c20b869dd8d2c98c672a943a2273e28fe8a6bcd
parentdeb3fd58506fbc8553ac3d52bd8a80576379d09c (diff)
downloadpykolab-63617be06a287fcba675d736eb20cbc2ec183539.tar.gz
Default can be an empty string as well as None (if the default is a missing configuration value)
-rw-r--r--pykolab/utils.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/pykolab/utils.py b/pykolab/utils.py
index ceb6f68..0da1664 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -36,12 +36,12 @@ def ask_question(question, default="", password=False, confirm=False):
Usage: pykolab.utils.ask_question("What is the server?", default="localhost")
"""
if password:
- if default == "":
+ if default == "" or default == None:
answer = getpass.getpass("%s: " % (question))
else:
answer = getpass.getpass("%s [%s]: " % (question, default))
else:
- if default == "":
+ if default == "" or default == None:
answer = raw_input("%s: " % (question))
else:
answer = raw_input("%s [%s]: " % (question, default))
@@ -52,12 +52,12 @@ def ask_question(question, default="", password=False, confirm=False):
answer_confirmed = False
while not answer_confirmed:
if password:
- if default == "":
+ if default == "" or default == None:
answer = getpass.getpass(_("Confirm %s: ") % (question))
else:
answer = getpass.getpass(_("Confirm %s [%s]: ") % (question, default))
else:
- if default == "":
+ if default == "" or default == None:
answer = raw_input(_("Confirm %s: ") % (question))
else:
answer = raw_input(_("Confirm %s [%s]: ") % (question, default))
@@ -67,12 +67,12 @@ def ask_question(question, default="", password=False, confirm=False):
"Please try again.")
if password:
- if default == "":
+ if default == "" or default == None:
answer = getpass.getpass(_("Confirm %s: ") % (question))
else:
answer = getpass.getpass(_("Confirm %s [%s]: ") % (question, default))
else:
- if default == "":
+ if default == "" or default == None:
answer = raw_input(_("Confirm %s: ") % (question))
else:
answer = raw_input(_("Confirm %s [%s]: ") % (question, default))