optional rset, those prototype could be simplified once bw compat for non named rset will be dropped
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 10 Jun 2009 10:01:06 +0200
changeset 2084 923788d1f9c6
parent 2083 f8f94c2951d3
child 2088 4ec37d33657e
optional rset, those prototype could be simplified once bw compat for non named rset will be dropped
selectors.py
--- a/selectors.py	Wed Jun 10 10:00:34 2009 +0200
+++ b/selectors.py	Wed Jun 10 10:01:06 2009 +0200
@@ -420,7 +420,7 @@
 
 @objectify_selector
 @lltrace
-def primary_view(cls, req, rset, row=None, col=0, view=None, **kwargs):
+def primary_view(cls, req, rset=None, row=None, col=0, view=None, **kwargs):
     """accept if view given as named argument is a primary view, or if no view
     is given
     """
@@ -430,7 +430,7 @@
 
 @objectify_selector
 @lltrace
-def match_context_prop(cls, req, rset, row=None, col=0, context=None,
+def match_context_prop(cls, req, rset=None, row=None, col=0, context=None,
                        **kwargs):
     """accept if:
     * no context given
@@ -461,7 +461,7 @@
                            ','.join(sorted(str(s) for s in self.expected)))
 
     @lltrace
-    def __call__(self, cls, req, rset, row=None, col=0, **kwargs):
+    def __call__(self, cls, req, rset=None, row=None, col=0, **kwargs):
         try:
             if not req.search_state[0] in self.expected:
                 return 0
@@ -554,7 +554,7 @@
     initializer
     """
     @lltrace
-    def __call__(self, cls, req, rset, row=None, col=0, view=None, **kwargs):
+    def __call__(self, cls, req, rset=None, row=None, col=0, view=None, **kwargs):
         if view is None or not view.id in self.expected:
             return 0
         return 1
@@ -571,7 +571,7 @@
         self.registry = registry
         self.oid = oid
 
-    def __call__(self, cls, req, rset, *args, **kwargs):
+    def __call__(self, cls, req, rset=None, *args, **kwargs):
         try:
             cls.vreg.select(self.registry, self.oid, req, rset=rset, **kwargs)
             return 1
@@ -850,7 +850,7 @@
         self.action = action
 
     @lltrace
-    def __call__(self, cls, req, rset, row=None, col=0, **kwargs):
+    def __call__(self, cls, req, rset=None, row=None, col=0, **kwargs):
         if rset is None:
             return 0
         user = req.user
@@ -935,6 +935,7 @@
     def __repr__(self):
         return u'<rql_condition "%s" at %x>' % (self.rql, id(self))
 
+
 class but_etype(EntitySelector):
     """accept if the given entity types are not found in the result set.