1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-24 02:04:09 +03:00

Enhanced "search user/groups" response on too many results

This commit is contained in:
Adolfo Gómez García 2018-02-01 04:59:20 +01:00
parent b6e5aeac29
commit a1bf0b92bb
2 changed files with 7 additions and 5 deletions

View File

@ -121,8 +121,8 @@ class Authenticators(ModelHandler):
return auth.searchUsers(term)
else:
return auth.searchGroups(term)
except Exception:
self.invalidRequestException()
except Exception as e:
self.invalidResponseException('{}'.format(e))
def test(self, type_):
from uds.core.Environment import Environment

View File

@ -44,7 +44,6 @@ from uds.core.util import permissions
from uds.core.util.model import processUuid
from uds.models import Tag
import fnmatch
import re
import itertools
@ -54,8 +53,7 @@ import logging
logger = logging.getLogger(__name__)
__updated__ = '2017-10-25'
__updated__ = '2018-02-01'
# a few constants
OVERVIEW = 'overview'
@ -256,6 +254,10 @@ class BaseModelHandler(Handler):
message = _('Invalid Request') if message is None else message
raise RequestError('{} {}: {}'.format(message, self.__class__, self._args))
def invalidResponseException(self, message=None):
message = 'Invalid response' if message is None else message
raise ResponseError(message)
def invalidMethodException(self):
'''
Raises a NotFound exception with translated "Method not found" string to current locale