- changed status to resolved
can't overrride __and__(), __or__() (and __invert__()?)
Issue #3012
resolved
from sqlalchemy import Integer, TypeDecorator, Column, type_coerce
class Foo(TypeDecorator):
impl = Integer
class comparator_factory(TypeDecorator.Comparator):
def __eq__(self, other):
print "EQ!"
return type_coerce(self.expr, Integer) == other
def __and__(self, other):
print "AND!"
return type_coerce(self.expr, Integer) & other
c = Column('x', Foo())
print c == 5
print c & 2
Comments (2)
-
reporter -
reporter - Fixed bug where the :meth:
.Operators.__and__
, :meth:.Operators.__or__
and :meth:.Operators.__invert__
operator overload methods could not be overridden within a custom :class:.TypeEngine.Comparator
implementation. fixes#3012
→ <<cset 24ca70afd0df>>
- Fixed bug where the :meth:
- Log in to comment
.Operators.__and__
, :meth:.Operators.__or__
and :meth:.Operators.__invert__
operator overload methods could not be overridden within a custom :class:.TypeEngine.Comparator
implementation. fixes#3012→ <<cset d1705a46fea6>>