From 8fb1d9a80e4f857a4c9e09ba7b23365cb77d1f34 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Thu, 6 Mar 2008 23:21:15 +0000 Subject: [PATCH] Temporary hack so that cache sets are performed whenever save() is called, regardless of commit flag. Without this, the file upload progress bar breaks because it gets a stale File object out of the cache. Eventually, it would be better if cache sets were only done condittionally based on commit flag, and also whenever Database.commit() is called. --- controller/Database.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/controller/Database.py b/controller/Database.py index cc90189..9b22f59 100644 --- a/controller/Database.py +++ b/controller/Database.py @@ -72,8 +72,12 @@ class Database( object ): if commit: connection.commit() - if self.__cache: - self.__cache.set( obj.cache_key, obj ) + + # FIXME: we shouldn't touch the cache unless there's actually a commit. + # the problem is that in self.commit() below, we don't know which objects + # to actually save into the cache + if self.__cache: + self.__cache.set( obj.cache_key, obj ) def commit( self ): self.__get_connection().commit()