diff options
-rw-r--r-- | gkeys/gkeys/utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gkeys/gkeys/utils.py b/gkeys/gkeys/utils.py index 64f11aa..f08acc1 100644 --- a/gkeys/gkeys/utils.py +++ b/gkeys/gkeys/utils.py @@ -39,6 +39,8 @@ try: except AttributeError: StringTypes = [str] +Y_N = ("y", "yes", "n", "no") + def encoder(text, _encoding_): return codecs.encode(text, _encoding_, 'replace') @@ -161,6 +163,13 @@ def path(path_elements): return pathname +def get_ack(prompt_msg, accepted=Y_N): + ack = None + while ack not in accepted: + ack = py_input(prompt_msg).lower() + return ack + + if __name__ == '__main__': import doctest doctest.testmod(sys.modules[__name__]) |