Add a middleware class like this: from django.http import HttpResponseForbidden from django.template import loader, RequestContext
class Http403(Exception): pass class ForbiddenMiddleware: def process_exception(self, request, exception): if not isinstance(exception, Http403): return try: template = loader.get_template('403.html') context = RequestContext(request, {'message': str(exception)}) return HttpResponseForbidden(template.render(context)) except: pass # Let Django show the exception Then you can throw a 403 simply by "raise Http403" in your view functions. On 16 Mayıs, 13:42, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > hey everyone, > > looking at the source code this isn't immediately clear to me... What if > I wanted to make a HttpPermissionError or HttpThisPageIsBeingUpdated or > ... exception that has it's own template? > > This way, from anywhere in the code you could throw your very own > exception... > > Am I correct in assuming this is NOT possible w/out editing the django code? > > - bram --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---