コード例 #1
0
ファイル: console.py プロジェクト: brenttaylor/WLTask
def get_password_prompt():
    """
    Asks the user if he wants to enter a password evey time a task is sent.

    Returns:
        bool - True if they want to be prompted for a password, otherwise False.
    """
    while True:
        try:
            password_prompt = console.get_bool("Do you wish to be prompted for your password every session? (Y/N): ")
            return password_prompt
        except ValueError:
            print "Error: Invalid input.  Please enter 'y' or 'n'"
コード例 #2
0
ファイル: console.py プロジェクト: brenttaylor/WLTask
def get_y_n(message):
    """
    Prompts the user with a yes/no question.

    Args:
        message:    The message displayed to prompt the user to enter an answer.

    Returns:
        bool - Returns True for "y", False for "n".
    """
    while True:
        try:
            tls = console.get_bool(message)
            return tls
        except ValueError:
            print "Error: Invalid input.  please enter 'y' or 'n'"