+ def __init__(self, request):
+ if request.user.is_authenticated():
+ super(HttpResponseUnauthorized, self).__init__(
+ content=render_to_string('403.html', context_instance=RequestContext(request)),
+ status=403
+ )
+ else:
+ super(HttpResponseUnauthorized, self).__init__(
+ content=render_to_string('401.html', context_instance=RequestContext(request)),
+ status=401
+ )
\ No newline at end of file