Environment access

The environment module encapsulates the access of all central information like logging, configuration management and threads.

You can import it to your own code like this:

>>> from clacks.common import Environment
>>> env = Environment.getInstance()

class clacks.common.env.Environment

The global information container, used as a singleton.

getDatabaseEngine(section, key='database')

Return a database engine from the registry.

Parameter Description
section name of the configuration section where the config is placed.
key optional value for the key where the database information is stored, defaults to database.

Return: database engine

getDatabaseSession(section, key='database')

Return a database session from the pool.

Parameter Description
section name of the configuration section where the config is placed.
key optional value for the key where the database information is stored, defaults to database.

Return: database session

static getInstance()

Act like a singleton and return the clacks.common.env.Environment instance.

Return: clacks.common.env.Environment