Fix error in rule matching: False overrides None even if later
authorPaul Crowley <paul@lshift.net>
Mon, 18 Apr 2011 10:52:45 +0100
changeset 297 9875791ab421
parent 296 6feeef02c057
child 298 cc4f145a8bc3
Fix error in rule matching: False overrides None even if later
src/mercurialserver/ruleset.py
--- a/src/mercurialserver/ruleset.py	Thu Apr 14 18:21:23 2011 +0100
+++ b/src/mercurialserver/ruleset.py	Mon Apr 18 10:52:45 2011 +0100
@@ -19,15 +19,16 @@
 def rule(pairs):
     matchers = [(k, globmatcher(v)) for k, v in pairs]
     def c(kw):
+        best = True
         for k, m in matchers:
             if k not in kw:
                 return False
             kkw = kw[k]
             if kkw is None:
-                return None
-            if m.match(kkw) is None:
+                best = None
+            elif m.match(kkw) is None:
                 return False
-        return True
+        return best
     return c
 
 class Ruleset(object):