def test_populate_dict(self): uowcommit, a1, b1, a_mapper, b_mapper = self._fixture() a1.obj().id = 10 pairs = [(a_mapper.c.id, b_mapper.c.id,)] dest = {} sync.populate_dict(a1, a_mapper, dest, pairs) eq_(dest, {'id':10})
def test_populate_dict(self): uowcommit, a1, b1, a_mapper, b_mapper = self._fixture() a1.obj().id = 10 pairs = [(a_mapper.c.id, b_mapper.c.id)] dest = {} sync.populate_dict(a1, a_mapper, dest, pairs) eq_(dest, {"id": 10})
def _synchronize(self, state, child, associationrow, clearkeys, uowcommit): if associationrow is None: return self._verify_canload(child) sync.populate_dict(state, self.parent, associationrow, self.prop.synchronize_pairs) sync.populate_dict(child, self.mapper, associationrow, self.prop.secondary_synchronize_pairs)
def _synchronize(self, state, child, associationrow, clearkeys, uowcommit, operation): if associationrow is None: return if child is not None and not uowcommit.session._contains_state(child): if not child.deleted: util.warn( "Object of type %s not in session, %s " "operation along '%s' won't proceed" % (mapperutil.state_class_str(child), operation, self.prop)) return False self._verify_canload(child) sync.populate_dict(state, self.parent, associationrow, self.prop.synchronize_pairs) sync.populate_dict(child, self.mapper, associationrow, self.prop.secondary_synchronize_pairs) return True