Index: branches/ast/geniusql/logic.py =================================================================== --- branches/ast/geniusql/logic.py (revision 121) +++ branches/ast/geniusql/logic.py (revision 129) @@ -288,27 +288,27 @@ def __repr__(self): return 'logic.Expression(%s)' % self.code() -## -## def __and__(self, other): -## """Logical-and this Expression with another.""" -## if not isinstance(other, Expression): -## other = Expression(other) -## ag = Aggregator(self.func) -## ag.and_combine(other.func) -## agfunc = ag.function() -## newkwtypes = self.kwtypes.copy() -## newkwtypes.update(other.kwtypes) -## return Expression(agfunc, newkwtypes) -## __add__ = __and__ -## -## def __or__(self, other): -## """Logical-or this Expression with another.""" -## if not isinstance(other, Expression): -## other = Expression(other) -## ag = Aggregator(self.func) -## ag.or_combine(other.func) -## agfunc = ag.function() -## newkwtypes = self.kwtypes.copy() -## newkwtypes.update(other.kwtypes) -## return Expression(agfunc, newkwtypes) + + def __and__(self, other): + """Logical-and this Expression with another.""" + if not isinstance(other, Expression): + other = Expression(other) + ag = Aggregator(self.func) + ag.and_combine(other.func) + agfunc = ag.function() + newkwtypes = self.kwtypes.copy() + newkwtypes.update(other.kwtypes) + return Expression(agfunc, newkwtypes) + __add__ = __and__ + + def __or__(self, other): + """Logical-or this Expression with another.""" + if not isinstance(other, Expression): + other = Expression(other) + ag = Aggregator(self.func) + ag.or_combine(other.func) + agfunc = ag.function() + newkwtypes = self.kwtypes.copy() + newkwtypes.update(other.kwtypes) + return Expression(agfunc, newkwtypes) def bind_args(self, **kwargs):