diff options
author | Rob Crittenden <rcritten@redhat.com> | 2010-02-12 16:34:21 -0500 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2010-02-15 13:10:11 -0700 |
commit | 58746226d4b36bc40de91d4d1dd283e9faaff639 (patch) | |
tree | 11c4cd42b0285ff366c68274495cd1e9ee7fa7da /ipalib/frontend.py | |
parent | 99dcf9d4f97ac8bff112d6ccc36bb5b894fa5bcd (diff) | |
download | freeipa-58746226d4b36bc40de91d4d1dd283e9faaff639.tar.gz freeipa-58746226d4b36bc40de91d4d1dd283e9faaff639.tar.xz freeipa-58746226d4b36bc40de91d4d1dd283e9faaff639.zip |
Use the Output tuple to determine the order of output
The attributes displayed is now dependant upon their definition in
a Param. This enhances that, giving some level of control over how
the result is displayed to the user.
This also fixes displaying group membership, including failures of
adding/removing entries.
All tests pass now though there is still one problem. We need to
return the dn as well. Once that is fixed we just need to comment
out all the dn entries in the tests and they should once again
pass.
Diffstat (limited to 'ipalib/frontend.py')
-rw-r--r-- | ipalib/frontend.py | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py index ae7ec945..0a1566e4 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -824,16 +824,27 @@ class Command(HasParam): result = output.get('result') summary = output.get('summary') - if (summary and isinstance(result, (list, tuple, dict)) and result): - textui.print_name(self.name) - - if isinstance(result, (tuple, list)): - textui.print_entries(result, self.output_params) - elif isinstance(result, dict): - textui.print_entry(result, self.output_params) + for o in self.output: + if 'no_display' in self.output[o].flags: + continue + result = output[o] + + if isinstance(result, (tuple, list)): + textui.print_entries(result, self.output_params) + elif isinstance(result, dict): + textui.print_entry(result, self.output_params) + elif isinstance(result, unicode): + if o == 'summary': + textui.print_summary(result) + else: + textui.print_indented(result) + elif isinstance(result, bool): + # the Delete commands return a boolean indicating + # success or failure. Ignore these. + pass + elif isinstance(result, int): + textui.print_count(result, '%s %%d' % self.output[o].doc) - if isinstance(summary, unicode): - textui.print_summary(summary) class LocalOrRemote(Command): |