/restlayer/exc.py
https://bitbucket.org/cedarlab/django-restlayer · Python · 22 lines · 12 code · 6 blank · 4 comment · 0 complexity · a6ab534eeb9a68fa8b9a41bc18677228 MD5 · raw file
- # -*- coding: utf-8 -*-
- #
- # This file is part of Django restlayer released under the MIT license.
- # See the LICENSE for more information.
- from django.http import HttpResponse
- class HttpException(Exception):
- def __init__(self, msg, status=500):
- super(HttpException, self).__init__(msg, status)
-
- class Http406(HttpException):
- def __init__(self):
- super(HttpException, self).__init__('', 406)
- class FormErrors(dict):
- pass
- class FormValidationError(HttpException):
- def __init__(self, form):
- super(FormValidationError, self).__init__(FormErrors(form.errors), 400)