Paper Office
paper-pptxAPI referencecompose

PackageTransaction

paper-pptx 0.2.0 API reference

Restore a package's original live graph if the guarded operation raises.

PackageTransaction(package: 'OpcPackage', *roots: object)

Functions

__enter__

func__enter__() -> 'PackageTransaction'

Capture this block's own rollback snapshot and open the boundary.

Every entry snapshots independently, nested ones included: an inner block that raises restores state as of its own entry, not the state before the outer block. Only the outermost block on a given package validates the candidate on clean exit.

Raises RuntimeError if this object is already inside its own with, and TransactionRollbackError if capturing the snapshot perturbs live state unrecoverably.

Returns

'PackageTransaction'

__exit__

func__exit__(exc_type, exc_value, traceback) -> bool

Close the boundary; never suppress an exception.

On an exception, restore this block's entry snapshot and let the original error propagate, unless a restore step also fails, in which case TransactionRollbackError propagates in its place and the package must be treated as unsafe. On clean exit from the outermost block, save and reopen the candidate, rolling back and re-raising if that fails.

Raises RuntimeError if the transaction was never entered, or if contexts exit out of order.

paramexc_type
paramexc_value
paramtraceback

Returns

bool

On this page