示例#1
0
 def test_clear(self):
     uowcommit, a1, b1, a_mapper, b_mapper = self._fixture()
     pairs = [(a_mapper.c.id, b_mapper.c.t1id)]
     b1.obj().t1id = 8
     eq_(b1.obj().__dict__["t1id"], 8)
     sync.clear(b1, b_mapper, pairs)
     eq_(b1.obj().__dict__["t1id"], None)
示例#2
0
 def test_clear(self):
     uowcommit, a1, b1, a_mapper, b_mapper = self._fixture()
     pairs = [(a_mapper.c.id, b_mapper.c.t1id,)]
     b1.obj().t1id = 8
     eq_(b1.obj().__dict__['t1id'], 8)
     sync.clear(b1, b_mapper, pairs)
     eq_(b1.obj().__dict__['t1id'], None)
示例#3
0
    def _synchronize(self,
                     state,
                     child,
                     associationrow,
                     clearkeys,
                     uowcommit,
                     operation=None):
        if state is None or \
            (not self.post_update and uowcommit.is_deleted(state)):
            return

        if operation is not None and \
            child is not None and \
            not uowcommit.session._contains_state(child):
            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

        if clearkeys or child is None:
            sync.clear(state, self.parent, self.prop.synchronize_pairs)
        else:
            self._verify_canload(child)
            sync.populate(child, self.mapper, state, self.parent,
                          self.prop.synchronize_pairs, uowcommit, False)
示例#4
0
    def _synchronize(self, state, child, associationrow, clearkeys, uowcommit):
        if state is None or (not self.post_update and uowcommit.is_deleted(state)):
            return

        if clearkeys or child is None:
            sync.clear(state, self.parent, self.prop.synchronize_pairs)
        else:
            self._verify_canload(child)
            sync.populate(child, self.mapper, state, self.parent, self.prop.synchronize_pairs)
示例#5
0
    def _synchronize(self, state, child, associationrow, clearkeys, uowcommit):
        if state is None or (not self.post_update and uowcommit.is_deleted(state)):
            return

        if clearkeys or child is None:
            sync.clear(state, self.parent, self.prop.synchronize_pairs)
        else:
            self._verify_canload(child)
            sync.populate(child, self.mapper, state, self.parent, self.prop.synchronize_pairs)
示例#6
0
 def _synchronize(self, state, child, associationrow, clearkeys, uowcommit):
     source = state
     dest = child
     if dest is None or (not self.post_update and uowcommit.is_deleted(dest)):
         return
     self._verify_canload(child)
     if clearkeys:
         sync.clear(dest, self.mapper, self.prop.synchronize_pairs)
     else:
         sync.populate(source, self.parent, dest, self.mapper, self.prop.synchronize_pairs)
示例#7
0
 def _synchronize(self, state, child, associationrow, clearkeys, uowcommit):
     source = state
     dest = child
     if dest is None or (not self.post_update and uowcommit.is_deleted(dest)):
         return
     self._verify_canload(child)
     if clearkeys:
         sync.clear(dest, self.mapper, self.prop.synchronize_pairs)
     else:
         sync.populate(source, self.parent, dest, self.mapper, self.prop.synchronize_pairs)
示例#8
0
    def _synchronize(self, state, child, associationrow,
                                        clearkeys, uowcommit, operation=None):
        if state is None or \
            (not self.post_update and uowcommit.is_deleted(state)):
            return

        if operation is not None and \
            child is not None and \
            not uowcommit.session._contains_state(child):
            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

        if clearkeys or child is None:
            sync.clear(state, self.parent, self.prop.synchronize_pairs)
        else:
            self._verify_canload(child)
            sync.populate(child, self.mapper, state, 
                            self.parent, 
                            self.prop.synchronize_pairs, 
                            uowcommit,
                            False)