urls: Route /error/NNN/ to static.views.handler.

Since our Apache configuration uses `ErrorDocument NNN /error/NNN/`,
this is necessary to return the correct status code in those cases.
This commit is contained in:
Brett Smith 2016-12-05 21:43:51 -05:00
parent 58e22337b0
commit cf5b073d44
2 changed files with 2 additions and 1 deletions

View file

@ -14,7 +14,7 @@ def handler(request, errorcode):
return HttpResponse("Internal error: " + path)
template = loader.get_template(path)
context = RequestContext(request)
return HttpResponse(template.render(context), status=errorcode)
return HttpResponse(template.render(context), status=int(errorcode))
def handler401(request):
return handler(request, 401)

View file

@ -50,6 +50,7 @@ urlpatterns = patterns('',
(r'^news(/|$)', include('conservancy.apps.news.urls')),
(r'^blog(/|$)', include('conservancy.apps.blog.urls')),
# formerly static templated things... (dirs with templates)
(r'^error/(40[134]|500)(?:/index\.html|/|)$', 'conservancy.static.views.handler'),
(r'^error', 'conservancy.static.views.index'),
(r'^about', 'conservancy.static.views.index'),
(r'^donate', 'conservancy.static.views.index'),