Package brisa :: Package core :: Module config
[hide private]
[frames] | no frames]

Module config

source code

BRisa configuration API consists of access methods (sets and gets) to the configuration.

When initialized (imported), the configuration reads data from the configuration persistence and stores it on a so called "state". By default, gets/sets do not apply directly on the persistence, but on the state. For example, setting a parameter value with a set_parameter() applies by default on the state.

The state can be save()'d - stored on the persistence - or update()'d - updated with latest persistence values.

There's an override that can be made in order to make sets/gets apply directly on the persistence. This can be achieved by setting direct_access to True. One can use directly config.manager.set_direct_access(True) or just set it directly with config.manager.direct_access = True.

Basically, holding a state is useful for avoiding overhead during runtime (some configurations never change during runtime and those that change are very out numbered). Also, for those configurations that needs monitoring, setting them and getting them is obviously faster when accessing the state.

Note that some methods of config.* are just links to methods of config.manager (like config.get_parameter and config.manager.get_parameter).

Special variables

Classes [hide private]
  ConfigurationManager
Class that provides an easy way of managing configurations.
  _BRisaConfigurationManager
Custom ConfigurationManager adapted to provide auto-upgrade with configurations merging for BRisa.
Functions [hide private]
 
get_platform_name()
Returns the platform name for this machine.
source code
Variables [hide private]
  brisa_home = os.path.join(os.path.expanduser('~'), ".brisa")
  _default_config = {'brisa': {'owner': 'brisa', 'version': '0.1...
  manager = _BRisaConfigurationManager()
  shared_url = ""
  get_parameter_bool = manager.get_parameter_bool
  get_parameter = manager.get_parameter
  get_parameter_as_list = manager.get_parameter_as_list
  set_parameter = manager.set_parameter
  contains = manager.contains
  __interface__ = get_parameter('connection', 'listenif')
  platform_name = get_platform_name()
Function Details [hide private]

get_platform_name()

source code 

Returns the platform name for this machine. May return 'win32', 'unix', 'java', 'mac' or '' (in case it wasn't possible to resolve the name).


Variables Details [hide private]

_default_config

Value:
{'brisa': {'owner': 'brisa', 'version': '0.10.0', 'encoding': 'utf-8',\
 'logging': 'INFO', 'logging.field_type': 'entry', 'logging_output': '\
file', 'logging_output.field_type': 'entry', 'listen_interface': 'eth0\
'}}