Changeset - cf5b073d44b0
[Not reviewed]
0 2 0
Brett Smith (brett) - 7 years ago 2016-12-06 02:43:51
brett@sfconservancy.org
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.
2 files changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
www/conservancy/static/views.py
Show inline comments
...
 
@@ -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)
www/conservancy/urls.py
Show inline comments
...
 
@@ -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'),
0 comments (0 inline, 0 general)