From 915486dadc476df4915cefdfeb8d61c43664ca60 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Thu, 4 Sep 2008 08:16:12 +0000 Subject: 260: Option.normalize() now does same conversion for multivalue as Option.convert() does --- ipalib/cli.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'ipalib/cli.py') diff --git a/ipalib/cli.py b/ipalib/cli.py index a495924e..d199f721 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -26,6 +26,7 @@ import sys import code import optparse import public +import errors def to_cli(name): @@ -161,14 +162,14 @@ class CLI(object): while True: if error is not None: print '>>> %s: %s' % (option.name, error) - value = raw_input(prompt) - if default is not None and len(value) == 0: - value = default - if len(value) == 0: - error = 'Must supply a value' - else: - kw[option.name] = value + raw = raw_input(prompt) + try: + value = option(raw) + if value is not None: + kw[option.name] = value break + except errors.ValidationError, e: + error = e.error cmd(*args, **kw) -- cgit