diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-10-17 21:05:03 -0600 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-10-17 21:05:03 -0600 |
commit | 721982870ed6dd5507a634d09dd06309abc3778a (patch) | |
tree | 966933871ad812bb06d7571807fa5f89f19819d9 /ipalib | |
parent | f1eb74e22cadf3a9f4ac991e0f8b922f6fb56d1e (diff) | |
download | freeipa-721982870ed6dd5507a634d09dd06309abc3778a.tar.gz freeipa-721982870ed6dd5507a634d09dd06309abc3778a.tar.xz freeipa-721982870ed6dd5507a634d09dd06309abc3778a.zip |
Removed generic Command.output_for_cli() method; CLI.run_interactive() now only calls output_for_cli() if it has been implemented
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/cli.py | 4 | ||||
-rw-r--r-- | ipalib/frontend.py | 9 |
2 files changed, 4 insertions, 9 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py index 07956e0a7..7148afc1c 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -301,7 +301,9 @@ class CLI(object): break except errors.ValidationError, e: error = e.error - cmd.output_for_cli(cmd(**kw)) + ret = cmd(**kw) + if callable(cmd.output_for_cli): + cmd.output_for_cli(ret) def parse(self, cmd, argv): parser = self.build_parser(cmd) diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 2c34b9722..af640cb59 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -496,6 +496,7 @@ class Command(plugable.Plugin): args = None options = None params = None + output_for_cli = None def __call__(self, *args, **kw): """ @@ -745,14 +746,6 @@ class Command(plugable.Plugin): multivalue = True yield arg - def output_for_cli(self, ret): - """ - Output result of this command to command line interface. - """ - assert type(ret) is dict, 'base output_for_cli() only works with dict' - for key in sorted(ret): - print '%s = %r' % (key, ret[key]) - class Object(plugable.Plugin): __public__ = frozenset(( |