# Path: castellan/i18n.py



import urllib
from castellan.i18n import _


class CastellanException(Exception):
    """Base Castellan Exception

    To correctly use this class, inherit from it and define
    a 'message' property. That message will get printf'd
    with the keyword arguments provided to the constructor.
    """
    message = _("An unknown exception occurred")

    def __init__(self, message_arg=None, *args, **kwargs):
        if not message_arg:
            message_arg = self.message
        try:
            self.message = message_arg % kwargs
        except Exception:
            if _FATAL_EXCEPTION_FORMAT_ERRORS:
                raise
            else:
                # at least get the core message out if something happened
                pass
        super(CastellanException, self).__init__(self.message)


class Forbidden(CastellanException):
    message = _("You are not authorized to complete this action.")


class KeyManagerError(CastellanException):

# Path: castellan/i18n.py



# Path: castellan/common/exception.py
import urllib
from castellan.i18n import _



class CastellanException(Exception):
    """Base Castellan Exception

    To correctly use this class, inherit from it and define
    a 'message' property. That message will get printf'd
    with the keyword arguments provided to the constructor.
    """
    message = _("An unknown exception occurred")

    def __init__(self, message_arg=None, *args, **kwargs):
        if not message_arg:
            message_arg = self.message
        try:
            self.message = message_arg % kwargs
        except Exception:
            if _FATAL_EXCEPTION_FORMAT_ERRORS:
                raise
            else:
                # at least get the core message out if something happened
                pass
        super(CastellanException, self).__init__(self.message)


class Forbidden(CastellanException):
    message = _("You are not authorized to complete this action.")


class KeyManagerError(CastellanException):

    message = _("Key manager error: %(reason)s")