> I'm about halfway done with an error middleware that handles this, > but my knowledge of how tracebacks/exceptions work is rusty. Can > anyone point me to information about how to extract the source code > context from a traceback frame? That's the only component I don't > have yet.
You could look at how Trac does it: http://projects.edgewall.com/trac/browser/trunk/trac/web/main.py def send_pretty_error(e, env, req=None) on line 199. Regards, Manuzhai