completely illiterate, but its definitely sub-optimal to "ensure" which is
non-ambiguous.
- invalid options sent to 'cascade' string will raise an exception [ticket:406]
+- fixed bug in mapper refresh/expire whereby eager loaders didnt properly re-populate
+item lists [ticket:407]
0.3.3
- string-based FROM clauses fixed, i.e. select(..., from_obj=["sometext"])
if populate_existing or context.session.is_expired(instance, unexpire=True):
if not context.identity_map.has_key(identitykey):
context.identity_map[identitykey] = instance
- if self.extension.populate_instance(self, context, row, instance, identitykey, True) is EXT_PASS:
- self.populate_instance(context, instance, row, identitykey, True)
+ isnew = True
+ if self.extension.populate_instance(self, context, row, instance, identitykey, isnew) is EXT_PASS:
+ self.populate_instance(context, instance, row, identitykey, isnew)
if self.extension.append_result(self, context, row, instance, identitykey, result, isnew) is EXT_PASS:
if result is not None:
result.append(instance)
# get the attribute, it refreshes
self.assert_(u.user_name == 'jack')
self.assert_(a not in u.addresses)
+
+ def testrefreshwitheager(self):
+ """test that a refresh/expire operation loads rows properly and sends correct "isnew" state to eager loaders"""
+ mapper(User, users, properties={'addresses':relation(mapper(Address, addresses), lazy=False)})
+ s = create_session()
+ u = s.get(User, 8)
+ assert len(u.addresses) == 3
+ s.refresh(u)
+ assert len(u.addresses) == 3
+ s = create_session()
+ u = s.get(User, 8)
+ assert len(u.addresses) == 3
+ s.expire(u)
+ assert len(u.addresses) == 3
+
def testbadconstructor(self):
"""test that if the construction of a mapped class fails, the instnace does not get placed in the session"""
class Foo(object):