1 from django.http import HttpResponse
2 from django.template.loader import render_to_string
3 from django.template import RequestContext
5 from forum import settings
7 class HttpResponseServiceUnavailable(HttpResponse):
8 def __init__(self, message):
9 super(HttpResponseServiceUnavailable, self).__init__(
10 content=render_to_string('503.html', {
12 'app_logo': settings.APP_LOGO,
13 'app_title': settings.APP_TITLE
16 class HttpResponseUnauthorized(HttpResponse):
17 def __init__(self, request):
18 if request.user.is_authenticated():
19 super(HttpResponseUnauthorized, self).__init__(
20 content=render_to_string('403.html', context_instance=RequestContext(request)),
24 super(HttpResponseUnauthorized, self).__init__(
25 content=render_to_string('401.html', context_instance=RequestContext(request)),
29 class HttpResponseNotFound(HttpResponse):
30 def __init__(self, request):
31 super(HttpResponseNotFound, self).__init__(
32 content=render_to_string('404.html', context_instance=RequestContext(request)),
36 class HttpResponseIntServerError(HttpResponse):
37 def __init__(self, request):
38 super(HttpResponseIntServerError, self).__init__(
39 content=render_to_string('500.html', context_instance=RequestContext(request)),