summaryrefslogtreecommitdiffstats
path: root/pykolab
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-15 09:13:28 +0100
commit4164aff2a7e7b958de6ae3c58f15ee618fbdba5f (patch)
treea92dcdbb0a5edb36cd74e369e38d49afcf385f70 /pykolab
parent00f37251e8d6681514d4084af69d1bd58a2cef59 (diff)
downloadpykolab-4164aff2a7e7b958de6ae3c58f15ee618fbdba5f.tar.gz
Default can be an empty string as well as None (if the default is a missing configuration value)
Diffstat (limited to 'pykolab')
-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))