From 1abe3abb87dee628003301c307f4c0d06fe0aa0d Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Fri, 14 Nov 2008 14:35:52 -0700 Subject: Tutorial: another small change to section on using output_for_cli() --- ipalib/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ipalib/__init__.py') 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. -- cgit