Skip to content

Instantly share code, notes, and snippets.

@dherbst
dherbst / gist:1286104
Created October 14, 2011 02:28
Django Status Code Middleware
class StatusCodeMiddleware(object):
'''
Returns the status_code.html file for the response.
'''
def process_response(self, request, response):
status_code = getattr(response, 'status_code', None)
if status_code and status_code >= 400:
template = u'%s.html' % status_code
try:
response = render_to_response(

Keybase proof

I hereby claim:

  • I am dherbst on github.
  • I am dherbst (https://keybase.io/dherbst) on keybase.
  • I have a public key ASAlJ7rZ-TIqmtpkGmHVY6kfrz9FUFX6XvCkPQjq0w6Uogo

To claim this, I am signing this object:

@dherbst
dherbst / london.go
Created April 12, 2019 13:40
Golang time in a location
package main
import (
"fmt"
"time"
)
const PolicyDateFormat = "02-01-2006 15:04:05"
func main() {