summaryrefslogtreecommitdiffstats
path: root/ipalib/__init__.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-11-14 14:35:52 -0700
committerJason Gerard DeRose <jderose@redhat.com>2008-11-14 14:35:52 -0700
commit1abe3abb87dee628003301c307f4c0d06fe0aa0d (patch)
tree13fd1eadd0782c150cd279f8b044b50297873142 /ipalib/__init__.py
parent0f1ed3e904ace46411db549551753005363c30f9 (diff)
downloadfreeipa-1abe3abb87dee628003301c307f4c0d06fe0aa0d.tar.gz
freeipa-1abe3abb87dee628003301c307f4c0d06fe0aa0d.tar.xz
freeipa-1abe3abb87dee628003301c307f4c0d06fe0aa0d.zip
Tutorial: another small change to section on using output_for_cli()
Diffstat (limited to 'ipalib/__init__.py')
-rw-r--r--ipalib/__init__.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ipalib/__init__.py b/ipalib/__init__.py
index da2e711a0..3e1dba9d4 100644
--- a/ipalib/__init__.py
+++ b/ipalib/__init__.py
@@ -584,14 +584,14 @@ For example, say we setup a command like this:
... city='Berlin',
... )
... if key in items:
-... return [(key, items[key])]
+... return items[key]
... return [
... (k, items[k]) for k in sorted(items, reverse=options['reverse'])
... ]
...
... def output_for_cli(self, textui, result, key, **options):
... if key is not None:
-... textui.print_keyval(result)
+... textui.print_plain('%s = %r' % (key, result))
... else:
... textui.print_name(self.name)
... textui.print_keyval(result)
@@ -645,7 +645,7 @@ Lastly, providing a ``key`` would result in the following:
>>> result = api.Command.show_items('city')
>>> api.Command.show_items.output_for_cli(textui, result, 'city', reverse=False)
- city = 'Berlin'
+city = 'Berlin'
See the `ipalib.cli.textui` plugin for a description of its methods.