Skip to main content

Patch `transaction` to support abort hooks

Project description

This package defines the parameterless function add_abort_hooks which patches transaction to support (before and after) abort hooks.

The support is analogous to that of before commit hooks. Especially, transaction._transaction.Transaction gets two new methods addBeforeAbortHook and addAfterAbortHook analoguous to addBeforeCommitHook with identical signature. The hooks are called at the begin or end, respectively, of Transaction.abort().

Note that the abort hooks are not called when the transaction is internally aborted during a transaction commit. In this case, the after commit hooks are called (with False as first parameter). Therefore, it is likely that you will register a corresponding pair of abort hook and after commit hook. In fact, I had expected that the after commit hooks would be called during abort as well, but the ZODB developers decided that not calling them on abort is a feature, not a bug.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dm.transaction.aborthook-1.0.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file dm.transaction.aborthook-1.0.tar.gz.

File metadata

File hashes

Hashes for dm.transaction.aborthook-1.0.tar.gz
Algorithm Hash digest
SHA256 30def72f7eb2a70a9ea6dbdf9674e2757b51550e1763238a4210fe0394228e77
MD5 6d85550aca29523efa9aab4985fde473
BLAKE2b-256 71f29b1ea855984fc71813f0c99df2bc331ed15984d47bd630d9de15e102facd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page