You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/02/05 21:23:35 UTC
[4/42] git commit: [#4691] Fixed AttributeError when expunging items
when removing them from the cache
[#4691] Fixed AttributeError when expunging items when removing them from the cache
Signed-off-by: Cory Johns <jo...@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/493f1b97
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/493f1b97
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/493f1b97
Branch: refs/heads/master
Commit: 493f1b970c89314f36622bba7bbb4298803ab2ae
Parents: 604e978
Author: Cory Johns <jo...@geek.net>
Authored: Mon Dec 10 18:41:49 2012 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Feb 5 20:22:50 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/493f1b97/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index bd6acfc..12c7f82 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()])