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.
This commit is contained in:
Rob Crittenden
2010-02-12 16:34:21 -05:00
committed by Jason Gerard DeRose
parent 99dcf9d4f9
commit 58746226d4
24 changed files with 388 additions and 161 deletions

View File

@@ -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='-'):