allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject git commit: [#4691] Fixed AttributeError when expunging items when removing them from the cache
Date Mon, 10 Dec 2012 18:42:09 GMT
Updated Branches:
  refs/heads/cj/4691 9cb9a1121 -> 5702abc9d


[#4691] Fixed AttributeError when expunging items when removing them from the cache

Signed-off-by: Cory Johns <johnsca@geek.net>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5702abc9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5702abc9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5702abc9

Branch: refs/heads/cj/4691
Commit: 5702abc9dc57ba9318a37d99bd1c2c86113e2786
Parents: 9cb9a11
Author: Cory Johns <johnsca@geek.net>
Authored: Mon Dec 10 18:41:49 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Mon Dec 10 18:41:49 2012 +0000

----------------------------------------------------------------------
 Allura/allura/model/repo.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5702abc9/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index cbb5145..a589531 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -886,8 +886,12 @@ class ModelCache(object):
         elif len(self._cache[cls]) >= self.max_size:
             # remove the least-recently-used cache item
             key, instance = self._cache[cls].popitem(last=False)
-            if instance and session(instance):
-                session(instance).expunge(instance)
+            try:
+                inst_session = session(instance)
+            except AttributeError:
+                inst_session = None
+            if inst_session:
+                inst_session.expunge(instance)
 
     def size(self):
         return sum([len(c) for c in self._cache.values()])


Mime
View raw message