diff -r c0c7a944c00d -r a3431f4e2f40 selectors.py --- a/selectors.py Mon Sep 28 16:39:10 2009 +0200 +++ b/selectors.py Tue Sep 29 15:58:44 2009 +0200 @@ -150,8 +150,8 @@ class ImplementsMixIn(object): """mix-in class for selectors checking implemented interfaces of something """ - def __init__(self, *expected_ifaces): - super(ImplementsMixIn, self).__init__() + def __init__(self, *expected_ifaces, **kwargs): + super(ImplementsMixIn, self).__init__(**kwargs) self.expected_ifaces = expected_ifaces def __str__(self): @@ -186,8 +186,9 @@ - `once_is_enough` is False, in which case if score_class return 0, 0 is returned """ - def __init__(self, once_is_enough=False): + def __init__(self, once_is_enough=False, accept_none=True): self.once_is_enough = once_is_enough + self.accept_none = accept_none @lltrace def __call__(self, cls, req, rset=None, row=None, col=0, **kwargs): @@ -195,9 +196,12 @@ return 0 score = 0 if row is None: + if not self.accept_none: + if any(rset[i][col] is None for i in xrange(len(rset))): + return 0 for etype in rset.column_types(col): if etype is None: # outer join - continue + return 0 escore = self.score(cls, req, etype) if not escore and not self.once_is_enough: return 0