# 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):


import os
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_control
from django.views.decorators.cache import cache_page
from django.views.generic import View
from wwwhisper_auth import http
# Copyright (C) 2013 Jan Wrobel <jan@mixedbit.org>




class Asset:
    """Stores a static file to be returned by requests."""

    def __init__(self, prefix, *args):
        assert prefix is not None
        self.body = file(os.path.join(prefix, *args)).read()


class StaticFileView(View):
    """ A view to serve a single static file."""

    asset = None

    @method_decorator(cache_control(private=True, max_age=60 * 60 * 5))
    def get(self, request):
        return self.do_get(self.asset.body)

class HtmlFileView(StaticFileView):

    def do_get(self, body):
        return http.HttpResponseOKHtml(body)

class JsFileView(StaticFileView):

    def do_get(self, body):

# 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/assets.py
import os
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_control
from django.views.decorators.cache import cache_page
from django.views.generic import View
from wwwhisper_auth import http

# Copyright (C) 2013 Jan Wrobel <jan@mixedbit.org>




class Asset:
    """Stores a static file to be returned by requests."""

    def __init__(self, prefix, *args):
        assert prefix is not None
        self.body = file(os.path.join(prefix, *args)).read()


class StaticFileView(View):
    """ A view to serve a single static file."""

    asset = None

    @method_decorator(cache_control(private=True, max_age=60 * 60 * 5))
    def get(self, request):
        return self.do_get(self.asset.body)

class HtmlFileView(StaticFileView):

    def do_get(self, body):
        return http.HttpResponseOKHtml(body)

class JsFileView(StaticFileView):

    def do_get(self, body):

        return http.HttpResponseOKJs(body)