Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)