paste.transaction – DB-API transactions

Middleware related to transactions and database connections.

At this time it is very basic; but will eventually sprout all that two-phase commit goodness that I don’t need.

Note

This is experimental, and will change in the future.

Module Contents

class paste.transaction.TransactionManagerMiddleware(application)
class paste.transaction.ConnectionFactory(module, *args, **kwargs)
Provides a callable interface for connecting to ADBAPI databases in a WSGI style (using the environment). More advanced connection factories might use the REMOTE_USER and/or other environment variables to make the connection returned depend upon the request.
paste.transaction.BasicTransactionHandler(application, factory)
Provides a simple mechanism for starting a transaction based on the factory; and for either committing or rolling back the transaction depending on the result. It checks for the response’s current status code either through the latest call to start_response; or through a HTTPException’s code. If it is a 100, 200, or 300; the transaction is committed; otherwise it is rolled back.