if against a column expression that combined
multiple entities together. [ticket:2197]
+ - [bug] fixed inappropriate evaluation of user-mapped
+ object in a boolean context within query.get()
+ [ticket:2310].
+
- Fixed bug apparent only in Python 3 whereby
sorting of persistent + pending objects during
flush would produce an illegal comparison,
not mapper.always_refresh and \
lockmode is None:
instance = self.session.identity_map.get(key)
- if instance:
+ if instance is not None:
# item present in identity map with a different class
if not issubclass(instance.__class__, mapper.class_):
return None
a1 = s.query(Address).filter_by(id=12).one()
assert a1.user is u1
+ @testing.resolve_artifact_names
+ def test_we_dont_call_bool(self):
+ class NoBoolAllowed(object):
+ def __nonzero__(self):
+ raise Exception("nope")
+ mapper(NoBoolAllowed, 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
@testing.resolve_artifact_names
def test_mapping_to_join_raises(self):