[predicates] use select_or_none rather than select+try/except, expected to be more efficient stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 03 Apr 2013 11:09:50 +0200
branchstable
changeset 8862 8011ca5d2841
parent 8839 49eb84b80b96
child 8863 98c107bd6cd0
[predicates] use select_or_none rather than select+try/except, expected to be more efficient
predicates.py
--- a/predicates.py	Tue Apr 02 15:11:41 2013 +0200
+++ b/predicates.py	Wed Apr 03 11:09:50 2013 +0200
@@ -479,11 +479,8 @@
 
     def __call__(self, cls, req, **kwargs):
         for regid in self.regids:
-            try:
-                req.vreg[self.registry].select(regid, req, **kwargs)
+            if req.vreg[self.registry].select_or_none(regid, req, **kwargs) is not None:
                 return self.selectable_score
-            except NoSelectableObject:
-                continue
         return 0