Exemplo n.º 1
0
    def after_flush(session, flush_context):
        """
        Hook to log revision snapshots. Must be post-flush in order to
        grab object IDs on new objects.

        """
        create_revisions(session)
Exemplo n.º 2
0
    def after_flush(session, flush_context):
        """
        Hook to log revision snapshots. Must be post-flush in order to
        grab object IDs on new objects.

        """
        # Note: `bump_redis_txn_id` __must__ come first. `create_revisions`
        # creates new objects which haven't been flushed to the db yet.
        # `bump_redis_txn_id` looks at objects on the session and expects them
        # to have already have an id (since they've already been flushed to the
        # db)
        try:
            bump_redis_txn_id(session)
        except Exception:
            log.exception("bump_redis_txn_id exception")
            pass
        create_revisions(session)