Changeset - 58e22337b06a
[Not reviewed]
0 1 0
Brett Smith (brett) - 4 years ago 2016-12-06 02:15:01
brett@sfconservancy.org
static: Errors return proper HTTP response code.
1 file changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
www/conservancy/static/views.py
Show inline comments
...
 
@@ -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:
0 comments (0 inline, 0 general)