potential bug in fire_replace_event of attributes.py

Issue #925 resolved
Former user created an issue
def fire_replace_event(self, state, value, previous, initiator):
    if self.key not in state.committed_state:
        state.committed_state[self.key](self.key) = previous
    state.modified = True

    if self.trackparent:
        if value is not None:
            self.sethasparent(value._state, True)
        if previous is not None:
            self.sethasparent(previous._state, False)

    instance = state.obj()
    for ext in self.extensions:
        ext.set(instance, value, previous, initiator or self)

examine the above code:

if value == previous, sethasparent would reset the state to False

Lei

Comments (2)

  1. Log in to comment