before_flush() sucks

Issue #1128 resolved
Mike Bayer repo owner created an issue
  1. needs a simple "reentrant" blocker so that autoflush on lazyload is blocked throughout the execution of session.flush()

  2. the reentrant blocker should raise an error for an explicit userland call to session.flush().

  3. the "new", "dirty" and "deleted" lists need to be (re-)calculated after the before_flush() method executes, geez... i.e.

    dirty = self._dirty_states

    ... (check for nothing dirty) ...

    now we're flushing

    flush_context = UOWTransaction(self)

    if self.extension is not None: self.extension.before_flush(self, flush_context, objects)

    # recalculate !
    dirty = self._dirty_states
    

    now get these

    deleted = set(self._deleted) new = set(self._new)

    dirty = set(dirty).difference(deleted)

Comments (2)

  1. Log in to comment