From: Evan Broder Date: Sun, 21 Feb 2010 05:55:52 +0000 (-0500) Subject: Clear all objects from the SQLAlchemy session at the start of each request. X-Git-Tag: 0.1.7~6 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/commitdiff_plain/04fa949d023fdb3e9fc623cf6c5aa3d620ff1ca3?ds=sidebyside Clear all objects from the SQLAlchemy session at the start of each request. The SA identity mapper isn't *supposed* to be a cache, but it sure can act like one sometimes. svn path=/trunk/packages/invirt-web/; revision=2993 --- diff --git a/code/invirt.fcgi b/code/invirt.fcgi index 64d55f7..41d724a 100755 --- a/code/invirt.fcgi +++ b/code/invirt.fcgi @@ -42,6 +42,7 @@ if __name__ == "__main__": app_config = { '/': { 'tools.invirtwebstate.on': True, + 'tools.clear_db_cache.on': True, }, } diff --git a/code/view.py b/code/view.py index 9452cf0..5f32874 100644 --- a/code/view.py +++ b/code/view.py @@ -7,6 +7,7 @@ import simplejson import datetime, decimal from StringIO import StringIO from invirt.config import structs as config +import invirt.database from webcommon import State @@ -163,6 +164,9 @@ cherrypy.tools.invirtwebstate = cherrypy.Tool('on_start_resource', invirtwebstate_init, priority=100) +cherrypy.tools.clear_db_cache = cherrypy.Tool('on_start_resource', invirt.database.clear_cache) + + class View(object): _cp_config = {'tools.mako.directories': [os.path.join(os.path.dirname(__file__),'templates')]}