Merge "Use wsme ClientSideError to handle unicode string"

This commit is contained in:
Jenkins 2013-10-31 05:48:01 +00:00 committed by Gerrit Code Review
commit 190a02a5fd

View File

@ -68,13 +68,12 @@ state_kind_enum = wtypes.Enum(str, *state_kind)
operation_kind = wtypes.Enum(str, 'lt', 'le', 'eq', 'ne', 'ge', 'gt') operation_kind = wtypes.Enum(str, 'lt', 'le', 'eq', 'ne', 'ge', 'gt')
class EntityNotFound(Exception): class EntityNotFound(wsme.exc.ClientSideError):
code = 404
def __init__(self, entity, id): def __init__(self, entity, id):
super(EntityNotFound, self).__init__( super(EntityNotFound, self).__init__(
_("%(entity)s %(id)s Not Found") % {'entity': entity, _("%(entity)s %(id)s Not Found") % {'entity': entity,
'id': id}) 'id': id},
status_code=404)
class BoundedInt(wtypes.UserType): class BoundedInt(wtypes.UserType):
@ -278,12 +277,11 @@ class Query(_Base):
return converted_value return converted_value
class ProjectNotAuthorized(Exception): class ProjectNotAuthorized(wsme.exc.ClientSideError):
code = 401
def __init__(self, id): def __init__(self, id):
super(ProjectNotAuthorized, self).__init__( 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): def _get_auth_project(on_behalf_of=None):