FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit de8dc851 authored by Dr Abraham Martin's avatar Dr Abraham Martin
Browse files

modify the way the template gets rendered as old way is deprecated in django >1.10

parent fe2a70ad
No related branches found
No related tags found
No related merge requests found
from django.contrib import messages
from django.http import HttpResponseServerError, HttpResponseForbidden
from django.template import loader, RequestContext
from django.template import RequestContext
from django.template.loader import get_template
from ucamwebauth import MalformedResponseError, InvalidResponseError, PublicKeyNotFoundError, UserNotAuthorised, \
OtherStatusCode
......@@ -14,10 +15,10 @@ class DefaultErrorBehaviour():
exception.__class__ == InvalidResponseError or \
exception.__class__ == OtherStatusCode or \
exception.__class__ == PublicKeyNotFoundError:
template = loader.get_template("ucamwebauth_500.html")
template = get_template("ucamwebauth_500.html")
messages.error(request, str(exception))
return HttpResponseServerError(template.render(RequestContext(request)))
return HttpResponseServerError(template.render({}, request))
elif exception.__class__ == UserNotAuthorised:
template = loader.get_template("ucamwebauth_403.html")
template = get_template("ucamwebauth_403.html")
messages.error(request, str(exception))
return HttpResponseForbidden(template.render(RequestContext(request)))
return HttpResponseForbidden(template.render({}, request))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment