# Path: devil/errors.py
# class HttpStatusCodeError(Exception):
# class BadRequest(HttpStatusCodeError):
# class Unauthorized(HttpStatusCodeError):
# class Forbidden(HttpStatusCodeError):
# class NotFound(HttpStatusCodeError):
# class NotAcceptable(HttpStatusCodeError):
# class MethodNotAllowed(HttpStatusCodeError):
# class Conflict(HttpStatusCodeError):
# class InternalServerError(HttpStatusCodeError):
#     def __init__(self, code, content=None, *args, **kw):
#     def get_code_num(self):
#     def has_code(self, code):
#     def __str__(self):
#     def __init__(self, *args, **kw):
#     def __init__(self, *args, **kw):
#     def __init__(self, *args, **kw):
#     def __init__(self, *args, **kw):
#     def __init__(self, *args, **kw):
#     def __init__(self, *args, **kw):
#     def __init__(self, *args, **kw):
#     def __init__(self, *args, **kw):


from devil import errors

        This is used for auto-generating missing permissions rows into
        database in syncdb.
        """

        return [cls.get_perm_name(resource, method) for method in cls.METHODS]

    @classmethod
    def get_perm_name(cls, resource, method):
        """ Compose permission name

        @param resource the resource
        @param method the request method (case doesn't matter).
        """

        return '%s_%s_%s' % (
            cls.PREFIX,
            cls._get_resource_name(resource),
            method.lower())

    def check_perm(self, request, resource):
        """ Check permission

        @param request the HTTP request
        @param resource the requested resource
        @raise Forbidden if the user doesn't have access to the resource
        """

        perm_name = self.get_perm_name(resource, request.method)
        if not self._has_perm(request.user, perm_name):

# Path: devil/errors.py
# class HttpStatusCodeError(Exception):
# class BadRequest(HttpStatusCodeError):
# class Unauthorized(HttpStatusCodeError):
# class Forbidden(HttpStatusCodeError):
# class NotFound(HttpStatusCodeError):
# class NotAcceptable(HttpStatusCodeError):
# class MethodNotAllowed(HttpStatusCodeError):
# class Conflict(HttpStatusCodeError):
# class InternalServerError(HttpStatusCodeError):
#     def __init__(self, code, content=None, *args, **kw):
#     def get_code_num(self):
#     def has_code(self, code):
#     def __str__(self):
#     def __init__(self, *args, **kw):
#     def __init__(self, *args, **kw):
#     def __init__(self, *args, **kw):
#     def __init__(self, *args, **kw):
#     def __init__(self, *args, **kw):
#     def __init__(self, *args, **kw):
#     def __init__(self, *args, **kw):
#     def __init__(self, *args, **kw):


# Path: devil/perm/acl.py
from devil import errors


        This is used for auto-generating missing permissions rows into
        database in syncdb.
        """

        return [cls.get_perm_name(resource, method) for method in cls.METHODS]

    @classmethod
    def get_perm_name(cls, resource, method):
        """ Compose permission name

        @param resource the resource
        @param method the request method (case doesn't matter).
        """

        return '%s_%s_%s' % (
            cls.PREFIX,
            cls._get_resource_name(resource),
            method.lower())

    def check_perm(self, request, resource):
        """ Check permission

        @param request the HTTP request
        @param resource the requested resource
        @raise Forbidden if the user doesn't have access to the resource
        """

        perm_name = self.get_perm_name(resource, request.method)
        if not self._has_perm(request.user, perm_name):

            raise errors.Forbidden()