Ticket #10360: custom-forbidden-msg.diff

File custom-forbidden-msg.diff, 852 bytes (added by tallfred, 6 years ago)
  • core/handlers/base.py

    class BaseHandler(object): 
    116116                        return self.handle_uncaught_exception(request, resolver, sys.exc_info())
    117117                    finally:
    118118                        receivers = signals.got_request_exception.send(sender=self.__class__, request=request)
    119         except exceptions.PermissionDenied:
    120             return http.HttpResponseForbidden('<h1>Permission denied</h1>')
     119        except exceptions.PermissionDenied, e:
     120            return http.HttpResponseForbidden(e.message or '<h1>Permission denied</h1>')
    121121        except SystemExit:
    122122            # Allow sys.exit() to actually exit. See tickets #1023 and #4701
    123123            raise
Back to Top