server/hook.py
changeset 4086 9b96126e0b14
parent 4075 e710f4052bd6
child 4104 7e478d7caf20
--- a/server/hook.py	Wed Dec 09 16:06:27 2009 +0100
+++ b/server/hook.py	Wed Dec 09 16:07:07 2009 +0100
@@ -156,6 +156,20 @@
     def __call__(self, cls, req, *args, **kwargs):
         return kwargs.get('rtype') in self.expected
 
+class match_rtype_sets(match_search_state):
+    """accept if parameters specified as initializer arguments are specified
+    in named arguments given to the selector
+    """
+
+    def __init__(self, *expected):
+        self.expected = expected
+
+    @lltrace
+    def __call__(self, cls, req, *args, **kwargs):
+        for rel_set in self.expected:
+            if kwargs.get('rtype') in rel_set:
+                return 1
+        return 0
 
 # base class for hook ##########################################################