pip install zodb-cm
- Provides a ZODB connection with auto-abort (default).
- Provides a tuple of connection and root object:
with ZConnection(db) as cx, root:
root.one = "ok"
- ZConnection implements a connection context manager.
- Transaction context managers in contrast do auto-commit:
- with
db.transaction()
as connection, or - with
cx.transaction_manager
as transaction, or - with
transaction.manager
as transaction (for the thread-local transaction manager)
- with
- See also http://www.zodb.org/en/latest/guide/transactions-and-threading.html
- Provides a ZODB database context manager.