Skip to content

Instantly share code, notes, and snippets.

@josiahcarlson
Created November 23, 2013 07:00
Show Gist options
  • Save josiahcarlson/7611735 to your computer and use it in GitHub Desktop.
Save josiahcarlson/7611735 to your computer and use it in GitHub Desktop.
Doesn't record objects in the session, you would need to explicitly call `session.save()` in order to save any entities. Also, if an entity falls out of all scopes, it is deallocated and you need to fetch from Redis again.
'''
The Josiah Carlson recommended way of replacing the session object. This code
should be run prior to any subsequent imports/uses of the session object.
Released into the public domain.
'''
from rom import util
class NoSession(util.Session):
def add(self, obj):
"Don't record any objects in the session."
return
util.session = NoSession()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment