src/mercurialserver/ruleset.py
changeset 301 f88549f44c8e
parent 300 31c2c6b383fd
child 311 3cbde66305e4
--- a/src/mercurialserver/ruleset.py	Mon Apr 18 11:44:36 2011 +0100
+++ b/src/mercurialserver/ruleset.py	Mon Apr 18 12:03:14 2011 +0100
@@ -42,13 +42,6 @@
         self.rules = []
         self.preset = {}
 
-    def add(self, action, conditions):
-        # Unrecognized actions are off the high end
-        if action in self.levels:
-            self.rules.append((self.levels.index(action), conditions))
-        else:
-            self.rules.append((len(self.levels), conditions))
-
     def set(self, **kw):
         self.preset.update(kw)
         
@@ -78,7 +71,13 @@
                 if len(l) == 0 or l.startswith("#"):
                     continue
                 l = l.split()
-                self.add(l[0], rule([c.split("=", 1) for c in l[1:]]))
+                # Unrecognized actions are off the high end
+                if l[0] in self.levels:
+                    ix = self.levels.index(l[0])
+                else:
+                    ix = len(self.levels)
+                self.rules.append((ix, 
+                    rule([c.split("=", 1) for c in l[1:]])))
         finally:
             f.close()