selectors.py
branch3.5
changeset 3276 4480887772a3
parent 2972 23418c13e024
child 3293 69c0ba095536
child 3345 10ad3869fc92
--- a/selectors.py	Wed Sep 16 19:26:21 2009 +0200
+++ b/selectors.py	Thu Sep 17 09:49:13 2009 +0200
@@ -960,7 +960,14 @@
     """
     def __init__(self, scorefunc, once_is_enough=False):
         super(score_entity, self).__init__(once_is_enough)
-        self.score_entity = scorefunc
+        def intscore(*args, **kwargs):
+            score = scorefunc(*args, **kwargs)
+            if not score:
+                return 0
+            if isinstance(score, (int, long)):
+                return score
+            return 1
+        self.score_entity = intscore
 
 
 # XXX DEPRECATED ##############################################################