diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-04 08:16:12 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-04 08:16:12 +0000 |
commit | 915486dadc476df4915cefdfeb8d61c43664ca60 (patch) | |
tree | 17621ba4e43f600be52f8044c8ba8ca5bfd7548a /ipalib/cli.py | |
parent | c7cd694d4f307e65f8e4cc5fb2e724e5f9700dea (diff) | |
download | freeipa-915486dadc476df4915cefdfeb8d61c43664ca60.tar.gz freeipa-915486dadc476df4915cefdfeb8d61c43664ca60.tar.xz freeipa-915486dadc476df4915cefdfeb8d61c43664ca60.zip |
260: Option.normalize() now does same conversion for multivalue as Option.convert() does
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r-- | ipalib/cli.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py index a495924ef..d199f7211 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) |