forked from shaba/openuds
Added ValidationError catch for users
This commit is contained in:
parent
a2bf6c5799
commit
018e6d742c
@ -34,8 +34,10 @@ from __future__ import unicode_literals
|
||||
# import time
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.forms.models import model_to_dict
|
||||
from uds.core.util.State import State
|
||||
from django.db import IntegrityError
|
||||
from django.core.exceptions import ValidationError
|
||||
|
||||
from uds.core.util.State import State
|
||||
|
||||
from uds.core.auths.Exceptions import AuthenticatorException
|
||||
from uds.core.util import log
|
||||
@ -133,6 +135,8 @@ class Users(DetailHandler):
|
||||
raise RequestError(_('User already exists (duplicate key error)'))
|
||||
except AuthenticatorException as e:
|
||||
raise RequestError(unicode(e))
|
||||
except ValidationError as e:
|
||||
raise RequestError(unicode(e.message))
|
||||
except Exception:
|
||||
logger.exception('Saving user')
|
||||
self.invalidRequestException()
|
||||
|
@ -44,7 +44,7 @@ import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
__updated__ = '2014-05-08'
|
||||
__updated__ = '2014-05-19'
|
||||
|
||||
|
||||
# a few constants
|
||||
@ -276,7 +276,7 @@ class DetailHandler(BaseModelHandler):
|
||||
'''
|
||||
Put is delegated to specific implementation
|
||||
'''
|
||||
logger.debug("Detail args for PUT: {0}, {1}".format(self._args, self._params))
|
||||
# logger.debug("Detail args for PUT: {0}, {1}".format(self._args, self._params))
|
||||
|
||||
parent = self._kwargs['parent']
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user