summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-02-12 16:34:21 -0500
committerJason Gerard DeRose <jderose@redhat.com>2010-02-15 13:10:11 -0700
commit58746226d4b36bc40de91d4d1dd283e9faaff639 (patch)
tree11c4cd42b0285ff366c68274495cd1e9ee7fa7da /ipalib/cli.py
parent99dcf9d4f97ac8bff112d6ccc36bb5b894fa5bcd (diff)
downloadfreeipa-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/cli.py')
-rw-r--r--ipalib/cli.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index b3980945b..d8c4b8058 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='-'):