From 58746226d4b36bc40de91d4d1dd283e9faaff639 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Fri, 12 Feb 2010 16:34:21 -0500 Subject: 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. --- ipalib/frontend.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'ipalib/frontend.py') 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): -- cgit