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:
parent
58e22337b0
commit
cf5b073d44
2 changed files with 2 additions and 1 deletions
|
@ -14,7 +14,7 @@ def handler(request, errorcode):
|
||||||
return HttpResponse("Internal error: " + path)
|
return HttpResponse("Internal error: " + path)
|
||||||
template = loader.get_template(path)
|
template = loader.get_template(path)
|
||||||
context = RequestContext(request)
|
context = RequestContext(request)
|
||||||
return HttpResponse(template.render(context), status=errorcode)
|
return HttpResponse(template.render(context), status=int(errorcode))
|
||||||
|
|
||||||
def handler401(request):
|
def handler401(request):
|
||||||
return handler(request, 401)
|
return handler(request, 401)
|
||||||
|
|
|
@ -50,6 +50,7 @@ urlpatterns = patterns('',
|
||||||
(r'^news(/|$)', include('conservancy.apps.news.urls')),
|
(r'^news(/|$)', include('conservancy.apps.news.urls')),
|
||||||
(r'^blog(/|$)', include('conservancy.apps.blog.urls')),
|
(r'^blog(/|$)', include('conservancy.apps.blog.urls')),
|
||||||
# formerly static templated things... (dirs with templates)
|
# 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'^error', 'conservancy.static.views.index'),
|
||||||
(r'^about', 'conservancy.static.views.index'),
|
(r'^about', 'conservancy.static.views.index'),
|
||||||
(r'^donate', 'conservancy.static.views.index'),
|
(r'^donate', 'conservancy.static.views.index'),
|
||||||
|
|
Loading…
Reference in a new issue