# Path: pytask/helpers/exceptions.py
# class PyTaskException(Exception):
#     """Base exception class to be used through out PyTask
#     """
# 
#     def __init__(self, message=None, **response_args):
#         """Constructor specifying the exception specific attributes.
#         """
# 
#         if not message:
#             message = DEFAULT_ERROR_MESSAGE
# 
#         self.message = message
#         self.response_args = response_args
# 
#         super(PyTaskException, self).__init__()
# 
# Path: pytask/helpers/exceptions.py
# class UnauthorizedAccess(PyTaskException):
#     """Exception that is raised when some one tries to access a view
#     without the right priviliges.
#     """
# 
#     def __init__(self, message=None, **response_args):
#         """Constructor specifying the exception specific attributes
#         """
# 
#         if not message:
#             message = DEFAULT_LOGIN_MESSAGE
# 
#         response_args['status'] = 401
# 
#         super(UnauthorizedAccess, self).__init__(message, **response_args)


from django.http import HttpResponse
from django.template import loader
from django.template import RequestContext
from pytask.helpers.exceptions import PyTaskException
from pytask.helpers.exceptions import UnauthorizedAccess
# (at your option) any later version.
#
# PyTask is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with PyTask.  If not, see <http://www.gnu.org/licenses/>.


"""Module containing the middleware that processes exceptions for PyTask.
"""

__authors__ = [
    '"Madhusudan.C.S" <madhusudancs@fossee.in>',
    ]





class ExceptionMiddleware(object):
    """Middleware definition that processes exceptions raised in PyTaskViews.
    """

    def process_exception(self, request, exception):
        """Process the exception raised.
        """


# Path: pytask/helpers/exceptions.py
# class PyTaskException(Exception):
#     """Base exception class to be used through out PyTask
#     """
# 
#     def __init__(self, message=None, **response_args):
#         """Constructor specifying the exception specific attributes.
#         """
# 
#         if not message:
#             message = DEFAULT_ERROR_MESSAGE
# 
#         self.message = message
#         self.response_args = response_args
# 
#         super(PyTaskException, self).__init__()
# 
# Path: pytask/helpers/exceptions.py
# class UnauthorizedAccess(PyTaskException):
#     """Exception that is raised when some one tries to access a view
#     without the right priviliges.
#     """
# 
#     def __init__(self, message=None, **response_args):
#         """Constructor specifying the exception specific attributes
#         """
# 
#         if not message:
#             message = DEFAULT_LOGIN_MESSAGE
# 
#         response_args['status'] = 401
# 
#         super(UnauthorizedAccess, self).__init__(message, **response_args)


# Path: pytask/middleware/exceptions.py
from django.http import HttpResponse
from django.template import loader
from django.template import RequestContext
from pytask.helpers.exceptions import PyTaskException
from pytask.helpers.exceptions import UnauthorizedAccess

# (at your option) any later version.
#
# PyTask is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with PyTask.  If not, see <http://www.gnu.org/licenses/>.


"""Module containing the middleware that processes exceptions for PyTask.
"""

__authors__ = [
    '"Madhusudan.C.S" <madhusudancs@fossee.in>',
    ]





class ExceptionMiddleware(object):
    """Middleware definition that processes exceptions raised in PyTaskViews.
    """

    def process_exception(self, request, exception):
        """Process the exception raised.
        """


        if (isinstance(exception, PyTaskException) or 