Use wsme ClientSideError to handle unicode string
We inherit from wsme.esc.ClientSideError to handle unicode string in error message. Fixes bug #1200518 Change-Id: I54a185a436b0a65bef13f303d7e31911cada76d8
This commit is contained in:
parent
6031964de2
commit
4b693d2703
@ -67,13 +67,12 @@ state_kind = ["ok", "alarm", "insufficient data"]
|
||||
operation_kind = wtypes.Enum(str, 'lt', 'le', 'eq', 'ne', 'ge', 'gt')
|
||||
|
||||
|
||||
class EntityNotFound(Exception):
|
||||
code = 404
|
||||
|
||||
class EntityNotFound(wsme.exc.ClientSideError):
|
||||
def __init__(self, entity, id):
|
||||
super(EntityNotFound, self).__init__(
|
||||
_("%(entity)s %(id)s Not Found") % {'entity': entity,
|
||||
'id': id})
|
||||
'id': id},
|
||||
status_code=404)
|
||||
|
||||
|
||||
class BoundedInt(wtypes.UserType):
|
||||
@ -269,12 +268,11 @@ class Query(_Base):
|
||||
return converted_value
|
||||
|
||||
|
||||
class ProjectNotAuthorized(Exception):
|
||||
code = 401
|
||||
|
||||
class ProjectNotAuthorized(wsme.exc.ClientSideError):
|
||||
def __init__(self, id):
|
||||
super(ProjectNotAuthorized, self).__init__(
|
||||
_("Not Authorized to access project %s") % id)
|
||||
_("Not Authorized to access project %s") % id,
|
||||
status_code=401)
|
||||
|
||||
|
||||
def _get_auth_project(on_behalf_of=None):
|
||||
|
Loading…
Reference in New Issue
Block a user