summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2010-10-27 22:53:08 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2010-10-27 22:53:08 +0100
commitc8d0eaff597164079866421a08ff993a8cdfe43f (patch)
tree7bd947c3b1e7382eac2e173109753d41b4ca523d
parent9dd56890008a4255dcf4a528b83dcc889013025e (diff)
downloadpykolab-c8d0eaff597164079866421a08ff993a8cdfe43f.tar.gz
Comment a little more on the utilities in pykolab/utils.py
-rw-r--r--pykolab/utils.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/pykolab/utils.py b/pykolab/utils.py
index b6b969c..c784bf9 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -6,7 +6,16 @@ import os
from pykolab import constants
def ask_question(question, default="", password=False):
+ """
+ Ask a question on stderr.
+
+ Since the answer to the question may actually be a password, cover that
+ case with a getpass.getpass() prompt.
+
+ Accepts a default value, but ignores defaults for password prompts.
+ Usage: pykolab.utils.ask_question("What is the server?", default="localhost")
+ """
if password:
answer = getpass.getpass("%s: " %(question))
else:
@@ -40,6 +49,7 @@ def ask_confirmation(question, default="y", all_inclusive_no=True):
# needs to provide the full yes or no for.
default_no = "'no'"
default_yes = "Please type 'yes'"
+
answer = False
while answer == False:
answer = raw_input("%s [%s/%s]: " %(question,default_yes,default_no))
@@ -96,7 +106,7 @@ def pop_empty_from_list(_input_list):
def is_service(services):
"""
Checks each item in list services to see if it has a RC script in
- constants.RC_DIR to see if it's a service, and returns
+ pykolab.constants.RC_DIR to see if it's a service, and returns
the name of the service for the first service it can find. However,
it also checks whether the other services exist and issues a warning if
more then one service exists.