selectors.py
changeset 6615 9807fb5d5f8d
parent 6565 e89de028d004
child 6869 900cb9b1b687
--- a/selectors.py	Mon Oct 25 10:18:10 2010 +0200
+++ b/selectors.py	Mon Oct 25 10:19:03 2010 +0200
@@ -777,7 +777,11 @@
 
     def score_class(self, eclass, req):
         # cache on vreg to avoid reloading issues
-        cache = req.vreg._is_instance_selector_cache
+        try:
+            cache = req.vreg._is_instance_selector_cache
+        except AttributeError:
+            # XXX 'before-registry-reset' not called for db-api connections
+            cache = req.vreg._is_instance_selector_cache = {}
         try:
             expected_eclasses = cache[self]
         except KeyError: