Skip to content

Instantly share code, notes, and snippets.

@jefftriplett
Forked from akrito/gist:444174
Created June 18, 2010 20:26
Show Gist options
  • Save jefftriplett/444180 to your computer and use it in GitHub Desktop.
Save jefftriplett/444180 to your computer and use it in GitHub Desktop.
try:
from ipdb import Pdb
except ImportError:
from pdb import Pdb
import sys
class PdbTraceback(object):
"""
Drops into pdb or ipdb if a view raises an exception. Should be the last
thing in MIDDLEWARE_CLASSES
"""
def process_exception(self, request, exception):
Pdb().interaction(None, sys.exc_info()[2])
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment