# Path: wwwhisper_auth/http.py
# TEXT_MIME_TYPE = 'text/plain; charset=utf-8'
# HTML_MIME_TYPE = 'text/html; charset=utf-8'
# JSON_MIME_TYPE = 'application/json; charset=utf-8'
# JS_MIME_TYPE = 'text/javascript; charset=UTF-8'
# def accepts_html(accept_header):
#     def __init__(self, message):
#     def __init__(self, attributes_dict):
#     def __init__(self, body):
#     def __init__(self, body):
#     def __init__(self):
#     def __init__(self, attributes_dict):
#     def __init__(self, location):
#     def __init__(self, html_response=None):
#     def __init__(self, html_response=None):
#     def __init__(self, message):
#     def __init__(self, message):
#     def __init__(self, message):
#     def __init__(self, message):
#     def __init__(self, message):
# def disallow_cross_site_request(decorated_method):
#     def wrapper(self, request, *args, **kwargs):
# def never_ever_cache(decorated_method):
#     def wrapper(*args, **kwargs):
#     def dispatch(self, request, *args, **kwargs):
# def _csrf_token_valid(request):
# def _utf8_encoded_json(request):
# class HttpResponseOK(HttpResponse):
# class HttpResponseOKJson(HttpResponse):
# class HttpResponseOKHtml(HttpResponse):
# class HttpResponseOKJs(HttpResponse):
# class HttpResponseNoContent(HttpResponse):
# class HttpResponseCreated(HttpResponse):
# class HttpResponseRedirect(HttpResponse):
# class HttpResponseNotAuthenticated(HttpResponse):
# class HttpResponseNotAuthorized(HttpResponse):
# class HttpResponseBadRequest(HttpResponse):
# class HttpResponseLimitExceeded(HttpResponse):
# class HttpResponseNotFound(HttpResponse):
# class HttpResponseServiceUnavailable(HttpResponse):
# class HttpResponseInternalError(HttpResponse):
# class RestView(View):
# 
# Path: wwwhisper_auth/models.py
# class LimitExceeded(Exception):
#     pass


from django.forms import ValidationError
from functools import wraps
from wwwhisper_auth import http
from wwwhisper_auth.models import LimitExceeded
import logging
    """Generic view over a collection of resources.

    Allows to get json representation of all resources in the
    collection and to add new resources to the collection.

    Attributes:
        collection_name: Name of the collection that view represents.
    """

    collection_name = None

    @set_collection
    def post(self, request, **kwargs):
        """Ads a new resource to the collection.

        Args:
            **kwargs: holds collection dependent arguments that are
              used to create the resource.
        Returns json representation of the added resource."""
        try:
            created_item = self.collection.create_item(**kwargs)
        except ValidationError as ex:
            # ex.messages is a list of errors.
            return http.HttpResponseBadRequest(', '.join(ex.messages))
        except LimitExceeded as ex:
            return http.HttpResponseLimitExceeded(str(ex))

        attributes_dict = created_item.attributes_dict(request.site_url)
        response = http.HttpResponseCreated(attributes_dict)
        response['Location'] = attributes_dict['self']

# Path: wwwhisper_auth/http.py
# TEXT_MIME_TYPE = 'text/plain; charset=utf-8'
# HTML_MIME_TYPE = 'text/html; charset=utf-8'
# JSON_MIME_TYPE = 'application/json; charset=utf-8'
# JS_MIME_TYPE = 'text/javascript; charset=UTF-8'
# def accepts_html(accept_header):
#     def __init__(self, message):
#     def __init__(self, attributes_dict):
#     def __init__(self, body):
#     def __init__(self, body):
#     def __init__(self):
#     def __init__(self, attributes_dict):
#     def __init__(self, location):
#     def __init__(self, html_response=None):
#     def __init__(self, html_response=None):
#     def __init__(self, message):
#     def __init__(self, message):
#     def __init__(self, message):
#     def __init__(self, message):
#     def __init__(self, message):
# def disallow_cross_site_request(decorated_method):
#     def wrapper(self, request, *args, **kwargs):
# def never_ever_cache(decorated_method):
#     def wrapper(*args, **kwargs):
#     def dispatch(self, request, *args, **kwargs):
# def _csrf_token_valid(request):
# def _utf8_encoded_json(request):
# class HttpResponseOK(HttpResponse):
# class HttpResponseOKJson(HttpResponse):
# class HttpResponseOKHtml(HttpResponse):
# class HttpResponseOKJs(HttpResponse):
# class HttpResponseNoContent(HttpResponse):
# class HttpResponseCreated(HttpResponse):
# class HttpResponseRedirect(HttpResponse):
# class HttpResponseNotAuthenticated(HttpResponse):
# class HttpResponseNotAuthorized(HttpResponse):
# class HttpResponseBadRequest(HttpResponse):
# class HttpResponseLimitExceeded(HttpResponse):
# class HttpResponseNotFound(HttpResponse):
# class HttpResponseServiceUnavailable(HttpResponse):
# class HttpResponseInternalError(HttpResponse):
# class RestView(View):
# 
# Path: wwwhisper_auth/models.py
# class LimitExceeded(Exception):
#     pass


# Path: wwwhisper_admin/views.py
from django.forms import ValidationError
from functools import wraps
from wwwhisper_auth import http
from wwwhisper_auth.models import LimitExceeded
import logging

    """Generic view over a collection of resources.

    Allows to get json representation of all resources in the
    collection and to add new resources to the collection.

    Attributes:
        collection_name: Name of the collection that view represents.
    """

    collection_name = None

    @set_collection
    def post(self, request, **kwargs):
        """Ads a new resource to the collection.

        Args:
            **kwargs: holds collection dependent arguments that are
              used to create the resource.
        Returns json representation of the added resource."""
        try:
            created_item = self.collection.create_item(**kwargs)
        except ValidationError as ex:
            # ex.messages is a list of errors.
            return http.HttpResponseBadRequest(', '.join(ex.messages))
        except LimitExceeded as ex:
            return http.HttpResponseLimitExceeded(str(ex))

        attributes_dict = created_item.attributes_dict(request.site_url)
        response = http.HttpResponseCreated(attributes_dict)
        response['Location'] = attributes_dict['self']

        response['Content-Location'] = attributes_dict['self']