selectors.py
changeset 5452 4ac3ea9face9
parent 5426 0d4853a6e5ee
child 5480 2d5c46e78ae9
equal deleted inserted replaced
5447:f29dafba250a 5452:4ac3ea9face9
   592         return 1
   592         return 1
   593     return 0
   593     return 0
   594 
   594 
   595 
   595 
   596 class multi_lines_rset(Selector):
   596 class multi_lines_rset(Selector):
   597     """If `nb`is specified, return 1 if the result set has exactly `nb` row of
   597     """If `nb` is specified, return 1 if the result set has exactly `nb` row of
   598     result. Else (`nb` is None), return 1 if the result set contains *at least*
   598     result. Else (`nb` is None), return 1 if the result set contains *at least*
   599     two rows.
   599     two rows.
   600     """
   600     """
   601     def __init__(self, nb=None):
   601     def __init__(self, nb=None):
   602         self.expected = nb
   602         self.expected = nb
   610     def __call__(self, cls, req, rset=None, **kwargs):
   610     def __call__(self, cls, req, rset=None, **kwargs):
   611         return rset is not None and self.match_expected(rset.rowcount)
   611         return rset is not None and self.match_expected(rset.rowcount)
   612 
   612 
   613 
   613 
   614 class multi_columns_rset(multi_lines_rset):
   614 class multi_columns_rset(multi_lines_rset):
   615     """If `nb`is specified, return 1 if the result set has exactly `nb` column
   615     """If `nb` is specified, return 1 if the result set has exactly `nb` column
   616     per row. Else (`nb` is None), return 1 if the result set contains *at least*
   616     per row. Else (`nb` is None), return 1 if the result set contains *at least*
   617     two columns per row. Return 0 for empty result set.
   617     two columns per row. Return 0 for empty result set.
   618     """
   618     """
   619 
   619 
   620     @lltrace
   620     @lltrace