# 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
    An open location can be accessed without authentication.
    """

    @staticmethod
    def _attributes_dict(request):
        """Attributes representing a resource to which a request is related."""
        return {
            'self' : _full_url(request)
        }

    def put(self, request, location_uuid):
        """Creates a resource that enables open access to a given location."""
        location = request.site.locations.find_item(location_uuid)
        if location is None:
            return http.HttpResponseNotFound('Location not found.')

        if location.open_access_granted():
            return http.HttpResponseOKJson(self._attributes_dict(request))

        location.grant_open_access()
        response =  http.HttpResponseCreated(self._attributes_dict(request))
        response['Location'] = _full_url(request)
        return response

    def get(self, request, location_uuid):
        """Check if a resource that enables open access to a location exists."""
        location = request.site.locations.find_item(location_uuid)
        if location is None:
            return http.HttpResponseNotFound('Location not found.')
        if not location.open_access_granted():

# 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

    An open location can be accessed without authentication.
    """

    @staticmethod
    def _attributes_dict(request):
        """Attributes representing a resource to which a request is related."""
        return {
            'self' : _full_url(request)
        }

    def put(self, request, location_uuid):
        """Creates a resource that enables open access to a given location."""
        location = request.site.locations.find_item(location_uuid)
        if location is None:
            return http.HttpResponseNotFound('Location not found.')

        if location.open_access_granted():
            return http.HttpResponseOKJson(self._attributes_dict(request))

        location.grant_open_access()
        response =  http.HttpResponseCreated(self._attributes_dict(request))
        response['Location'] = _full_url(request)
        return response

    def get(self, request, location_uuid):
        """Check if a resource that enables open access to a location exists."""
        location = request.site.locations.find_item(location_uuid)
        if location is None:
            return http.HttpResponseNotFound('Location not found.')
        if not location.open_access_granted():

            return http.HttpResponseNotFound(