Back to the homepage

Exceptional improvements

A while back I released a Django extension that makes it possible to raise exceptions for any HTTP status code. At the time this was mostly interesting to enable raising 403 Forbidden consistently; since the release of Django 1.3, and the introduction of class based generic views, this becomes more useful.

I've just uploaded a new version to PyPI which provides basic support for raising redirects as exceptions (basically, it does the exceptional processing even with DEBUG=True). At Artfinder I'm using it to implement slug redirects, where I'm overriding SingleObjectMixin.get_object to cope with slug changes without breaking old links; there are undoubtedly other useful things that can be done in a similar way.

At some point in the future, hopefully in Django 1.4, you'll be able to achieve the same effect with some built-in support, but for the time being django_exceptional_middleware is still useful.

  • Written by James Aylett
  • at 2011-04-11 09.30
  1. Introducing Accessibility Advent
  2. Accessibility Advent: normal accessibility advice still applies
  3. Accessibility Advent: scrolling issues redux
  4. Accessibility Advent: only I get to put stuff in text inputs
  5. Accessibility Advent: enhance long drop downs
  6. Accessibility Advent: beware focus events, redux
  7. Accessibility Advent: please avoid being clever, particularly with form elements
  8. Accessibility Advent: show jump links on focus
  9. Accessibility Advent: don't jiggle the layout
Archives
  • Ari Paparo
  • Jane Espenson
  • John Finnemore
  • Tim Bray
  • Marianne Levy
  • Richard Boulton (on Xapian)
  • Simon Willison
  • Niqui Merret
  • Darien Graham-Smith
  • Rebecca Cottrell
More links
  • Homepage
  • Latest blog entries
  • About me
  • Contact me
  • Things I've done with computers
  • Twitter status
  • Talk To Rex for film/writing/satire
  • Kittens with Jetpacks for consulting
  • Linked In profile
  • Flickr photos
  • Made Up Words for theatre
  • del.icio.us bookmarks
  • upcoming events
  • Things I Love (in case you want to buy me things :-)
  • Other blog entries feed
  • spacer
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.