selectors.py
changeset 5561 58b05c314443
parent 5557 1a534c596bff
child 5564 d13830a2adfd
--- a/selectors.py	Fri May 21 07:56:39 2010 +0200
+++ b/selectors.py	Fri May 21 13:34:03 2010 +0200
@@ -531,6 +531,7 @@
     * `regids`, object identifiers in this registry, one of them should be
       selectable.
     """
+    selectable_score = 1
     def __init__(self, registry, *regids):
         self.registry = registry
         self.regids = regids
@@ -539,7 +540,7 @@
         for regid in self.regids:
             try:
                 req.vreg[self.registry].select(regid, req, **kwargs)
-                return 1
+                return self.selectable_score
             except NoSelectableObject:
                 return 0
 
@@ -553,6 +554,9 @@
       (usually entities) should be adaptable. One of them should be selectable
       when multiple identifiers are given.
     """
+    # implementing an interface takes precedence other special Any interface,
+    # hence return 2 (implements('Any') score is 1)
+    selectable_score = 2
     def __init__(self, *regids):
         super(adaptable, self).__init__('adapters', *regids)