object in a boolean context within query.get()
[ticket:2310].
generates columns to put up onto the base.
- orm
+ - [bug] fixed inappropriate evaluation of user-mapped
+ object in a boolean context within query.get()
+ [ticket:2310]. Also in 0.6.9.
+
- [bug] Added missing comma to PASSIVE_RETURN_NEVER_SET
symbol [ticket:2304]
"""
instance = session.identity_map.get(key)
- if instance:
+ if instance is not None:
state = attributes.instance_state(instance)
s.add(A())
s.commit()
+ def test_we_dont_call_bool(self):
+ class NoBoolAllowed(object):
+ def __nonzero__(self):
+ raise Exception("nope")
+ mapper(NoBoolAllowed, self.tables.users)
+ u1 = NoBoolAllowed()
+ u1.name = "some name"
+ s = Session(testing.db)
+ s.add(u1)
+ s.commit()
+ assert s.query(NoBoolAllowed).get(u1.id) is u1
+
def test_we_dont_call_eq(self):
class NoEqAllowed(object):
def __eq__(self, other):