Made the multimatch error messages with the multimatch_string supplied more useful, addressing the first part of #933.
This commit is contained in:
parent
3c1245b1a6
commit
08f34ae61b
1 changed files with 9 additions and 11 deletions
|
|
@ -1549,15 +1549,13 @@ def at_search_result(matches, caller, query="", quiet=False, **kwargs):
|
|||
error = kwargs.get("nofound_string") or _("Could not find '%s'." % query)
|
||||
matches = None
|
||||
elif len(matches) > 1:
|
||||
error = kwargs.get("multimatch_string", None)
|
||||
if not error:
|
||||
error = _("More than one match for '%s'" \
|
||||
" (please narrow target):" % query)
|
||||
for num, result in enumerate(matches):
|
||||
error += "\n %i%s%s%s" % (
|
||||
num + 1, _MULTIMATCH_SEPARATOR,
|
||||
result.get_display_name(caller) if hasattr(result, "get_display_name") else result.key,
|
||||
result.get_extra_info(caller))
|
||||
error = kwargs.get("multimatch_string",
|
||||
_("More than one match for '%s' (please narrow target):" % query))
|
||||
for num, result in enumerate(matches):
|
||||
error += "\n %i%s%s%s" % (
|
||||
num + 1, _MULTIMATCH_SEPARATOR,
|
||||
result.get_display_name(caller) if hasattr(result, "get_display_name") else result.key,
|
||||
result.get_extra_info(caller))
|
||||
matches = None
|
||||
else:
|
||||
# exactly one match
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue