From 2ff4b3906ffbcd89330e40fa7f69f5c668996b72 Mon Sep 17 00:00:00 2001 From: Pavel Zuna Date: Mon, 15 Jun 2009 15:59:20 +0200 Subject: Change plugins2 using find_entries to support incomplete (truncated) search results. --- ipalib/plugins/host2.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'ipalib/plugins/host2.py') diff --git a/ipalib/plugins/host2.py b/ipalib/plugins/host2.py index 02a2a6ed..52f1d3a3 100644 --- a/ipalib/plugins/host2.py +++ b/ipalib/plugins/host2.py @@ -308,21 +308,30 @@ class host2_find(crud.Search): attrs_list = _default_attributes try: - entries = ldap.find_entries(filter, attrs_list, _container_dn) + (entries, truncated) = ldap.find_entries( + filter, attrs_list, _container_dn + ) except errors.NotFound: - entries = tuple() + (entries, truncated) = (tuple(), False) return entries def output_for_cli(self, textui, result, term, **options): + (entries, truncated) = result + textui.print_name(self.name) - for (dn, entry_attrs) in result: + for (dn, entry_attrs) in entries: textui.print_attribute('dn', dn) textui.print_entry(entry_attrs) textui.print_plain('') textui.print_count( len(result), '%i host matched.', '%i hosts matched.' ) + if truncated: + textui.print_dashed('These results are truncated.', below=False) + textui.print_dashed( + 'Please refine your search and try again.', above=False + ) api.register(host2_find) -- cgit