diff options
author | Martin Babinsky <mbabinsk@redhat.com> | 2016-03-18 09:56:08 +0100 |
---|---|---|
committer | Martin Basti <mbasti@redhat.com> | 2016-04-13 17:52:22 +0200 |
commit | 62bb478e112cd4677e681f4750c5f5e5c9221607 (patch) | |
tree | e91d8bf788c5306a161b14c62489a22c6dd08811 /ipalib | |
parent | 1f0959735f9828a09439f17f1468dcd3dfb914db (diff) | |
download | freeipa-62bb478e112cd4677e681f4750c5f5e5c9221607.tar.gz freeipa-62bb478e112cd4677e681f4750c5f5e5c9221607.tar.xz freeipa-62bb478e112cd4677e681f4750c5f5e5c9221607.zip |
specify type of exceeded limit when warning about truncated search results
API commands inheriting from LDAPSearch should mention which limit was
exceeded in the warning message sent with truncated results.
https://fedorahosted.org/freeipa/ticket/5677
Reviewed-By: Petr Spacek <pspacek@redhat.com>
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/messages.py | 2 | ||||
-rw-r--r-- | ipalib/plugins/baseldap.py | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/ipalib/messages.py b/ipalib/messages.py index 872b455c1..c37cceb3f 100644 --- a/ipalib/messages.py +++ b/ipalib/messages.py @@ -338,7 +338,7 @@ class SearchResultTruncated(PublicMessage): errno = 13017 type = "warning" - format = _("Search result has been truncated to configured search limit.") + format = _("Search result has been truncated: %(reason)s") class BrokenTrust(PublicMessage): diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py index 0eae45dbd..dc61fe454 100644 --- a/ipalib/plugins/baseldap.py +++ b/ipalib/plugins/baseldap.py @@ -2104,8 +2104,11 @@ class LDAPSearch(BaseLDAPCommand, crud.Search): truncated=bool(truncated), ) - if truncated: - add_message(options['version'], result, SearchResultTruncated()) + try: + ldap.handle_truncated_result(truncated) + except errors.LimitsExceeded as e: + add_message(options['version'], result, SearchResultTruncated( + reason=e)) return result |