allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [31/50] git commit: [#4691] Fixed AttributeError when expunging items when removing them from the cache
Date Tue, 22 Jan 2013 23:23:18 GMT
[#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/2bacf333
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/2bacf333
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/2bacf333

Branch: refs/heads/cj/4691
Commit: 2bacf3333e94845903291e5f6bf97b85a8ac520c
Parents: 26191d1
Author: Cory Johns <johnsca@geek.net>
Authored: Mon Dec 10 18:41:49 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Tue Jan 22 23:22:44 2013 +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/2bacf333/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