sqlobject.wsgi_middleware module¶
-
class
sqlobject.wsgi_middleware.
SQLObjectMiddleware
(app, conn, use_transaction, hub)[source]¶ Bases:
object
-
sqlobject.wsgi_middleware.
make_middleware
(app, global_conf, database=None, use_transaction=False, hub=None)[source]¶ WSGI middleware that sets the connection for the request (using the database URI or connection object) and the given hub (or
sqlobject.sqlhub
if not given).If
use_transaction
is true, then the request will be run in a transaction.Applications can use the keys (which are all no-argument functions):
sqlobject.get_connection()
:- Returns the connection object
sqlobject.abort()
:- Aborts the transaction. Does not raise an error, but at the end of the request there will be a rollback.
sqlobject.begin()
:- Starts a transaction. First commits (or rolls back if aborted) if this is run in a transaction.
sqlobject.in_transaction()
:- Returns true or false, depending if we are currently in a transaction.