Module s.d.runtime

Part of stoqlib.database

Runtime routines for applications
Class StoqlibTransaction Undocumented
Function get_connection This function returns a connection to the current database.
Function new_transaction Create a new transaction.
Function rollback_and_begin Abort changes in models and begins the transaction.
Function finish_transaction Encapsulated method for committing/aborting changes in models.
Function _register_branch Undocumented
Function set_current_branch_station Registers the current station and the branch of the station
Function get_current_user Fetch the user which is currently logged into the system or None
Function get_current_branch Fetches the current branch company.
Function get_current_station Fetches the current station (computer) which we are running on
def get_connection():
This function returns a connection to the current database. Notice that connections are considered read-only inside Stoqlib applications. Only transactions can modify objects and should be created using new_transaction(). This function depends on the IDatabaseSettings utility which must be provided before it can be used.
Returnsa database connection
def new_transaction():
Create a new transaction.
Returnsa transaction
def rollback_and_begin(trans):
Abort changes in models and begins the transaction.
Parameterstransa transaction
def finish_transaction(trans, commit):
Encapsulated method for committing/aborting changes in models.
Parameterstransa transaction
commitTrue for commit, False for rollback_and_begin
def _register_branch(station_name):
Undocumented
def set_current_branch_station(conn, station_name):
Registers the current station and the branch of the station as the current branch for the system
Parametersconna database connection
station_namename of the station to register
def get_current_user(conn):
Fetch the user which is currently logged into the system or None None means that there are no utilities available which in turn should only happens during startup, for example when creating a new database or running the migration script, at that point no users are logged in
Returnscurrently logged in user or None (type: an object implementing IUser )
def get_current_branch(conn):
Fetches the current branch company.
Returnsthe current branch (type: an object implementing IBranch )
def get_current_station(conn):
Fetches the current station (computer) which we are running on
Parameterscurrent station
Returns (type: BranchStation )
API Documentation for Stoqlib, generated by pydoctor at 2009-07-14 16:00:32.