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/cli.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'ipalib/cli.py') diff --git a/ipalib/cli.py b/ipalib/cli.py index b3980945..d8c4b805 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -144,7 +144,6 @@ class textui(backend.Backend): Convert a binary value to base64. We know a value is binary if it is a python str type, otherwise it is a plain string. """ - assert isinstance(value, basestring) if type(value) is str: return base64.b64encode(value) else: @@ -231,15 +230,15 @@ class textui(backend.Backend): >>> items = [ ... ('in_server', True), - ... ('mode', 'production'), + ... ('mode', u'production'), ... ] >>> ui = textui() >>> ui.print_keyval(items) in_server = True - mode = 'production' + mode = u'production' >>> ui.print_keyval(items, indent=0) in_server = True - mode = 'production' + mode = u'production' Also see `textui.print_indented`. """ @@ -354,7 +353,11 @@ class textui(backend.Backend): if isinstance(value, (list, tuple)): value = map(lambda v: self.encode_binary(v), value) value = ', '.join(value) - self.print_indented(format % (label, value), indent) + if isinstance(value, dict): + self.print_indented(format % (label, ''), indent) + self.print_entry(value, params, indent=indent+1) + else: + self.print_indented(format % (label, value), indent) def print_dashed(self, string, above=True, below=True, indent=0, dash='-'): -- cgit