From 58e22337b06ac8f79dc0f6c8c054c9fac8d6d635 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Mon, 5 Dec 2016 21:15:01 -0500 Subject: [PATCH] static: Errors return proper HTTP response code. --- www/conservancy/static/views.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/www/conservancy/static/views.py b/www/conservancy/static/views.py index dcb405c7..36985e53 100644 --- a/www/conservancy/static/views.py +++ b/www/conservancy/static/views.py @@ -8,25 +8,25 @@ STATIC_ROOT = os.path.abspath(os.path.dirname(__file__)) FILESYSTEM_ENCODING = 'utf-8' def handler(request, errorcode): - path = os.path.join('error', errorcode, 'index.html') + path = os.path.join('error', str(errorcode), 'index.html') fullpath = os.path.join(STATIC_ROOT, path) if not os.path.exists(fullpath): return HttpResponse("Internal error: " + path) template = loader.get_template(path) context = RequestContext(request) - return HttpResponse(template.render(context)) + return HttpResponse(template.render(context), status=errorcode) def handler401(request): - return handler(request, '401') + return handler(request, 401) def handler403(request): - return handler(request, '403') + return handler(request, 403) def handler404(request): - return handler(request, '404') + return handler(request, 404) def handler500(request): - return handler(request, '500') + return handler(request, 500) def fundgoal_lookup(fundraiser_sought): try: