Skip to content

Instantly share code, notes, and snippets.

@bdarnell
bdarnell / django_tornado_handler.py
Created October 29, 2010 18:59
django_tornado_handler.py
# NOTE: This code was extracted from a larger class and has not been
# tested in this form. Caveat emptor.
import django.conf
import django.contrib.auth
import django.core.handlers.wsgi
import django.db
import django.utils.importlib
import httplib
import json
import logging
@whilefalse
whilefalse / Pymongo Dereference a List
Created August 21, 2009 09:04
Pymongo has some really cool auto dereferencing stuff build in. However, web.py was playing with my session object and saving back the dereferenced version. This allows me to dereference a list of DBRefs manually.
def deref_list(db, list):
return map(lambda(ref): db.dereference(ref), list)