Skip to content

Instantly share code, notes, and snippets.

View mattoc's full-sized avatar

Matt Stevenson mattoc

View GitHub Profile
@stefanv
stefanv / sparks.py
Created November 17, 2011 00:25
Command line sparks in Python
#!/usr/bin/python
# coding=utf-8
# Python version of Zach Holman's "spark"
# https://github.com/holman/spark
# by Stefan van der Walt <stefan@sun.ac.za>
"""
USAGE:
@sidmitra
sidmitra / add_user_info_to_request_middleware.py
Created October 26, 2010 05:16
Middleware to add user info to the current django request
class ExceptionUserInfoMiddleware(object):
"""
Adds user details to request context on receiving an exception, so that they show up in the error emails.
Add to settings.MIDDLEWARE_CLASSES and keep it outermost(i.e. on top if possible). This allows
it to catch exceptions in other middlewares as well.
"""
def process_exception(self, request, exception):
"""