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

Class _BRisaConfigurationManager

source code

          object --+    
                   |    
ConfigurationManager --+
                       |
                      _BRisaConfigurationManager

Custom ConfigurationManager adapted to provide auto-upgrade with configurations merging for BRisa.

Instance Methods [hide private]
 
__init__(self)
Constructor for the _BRisaConfigurationManager class.
source code
 
_merge_configs(self)
Merges an old configuration with the default one.
source code
 
_check_config_file(self)
If brisa home does not exist for the user or it exists and does not contain a configuration file, a default configuration is used.
source code
 
_initialize_database(self)
Creates an initial database for BRisa.
source code

Inherited from ConfigurationManager: contains, get_direct_access, get_parameter, get_parameter_as_list, get_parameter_bool, get_section_names, items, rem_section, save, set_direct_access, set_parameter, update

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  _merge_configurations = False
  brisa_version = brisa_version
  brisa_home = os.path.join(os.path.expanduser('~'), ".brisa")
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Constructor for the _BRisaConfigurationManager class.

Parameters:
  • config_path - path of the database to work on. If not supplied will work on a memory database.
  • default_config - default sections and parameters. Keys are section names and values are dicts where keys,value pairs represent a parameter name and value, respectivelly.
Overrides: object.__init__

_check_config_file(self)

source code 

If brisa home does not exist for the user or it exists and does not contain a configuration file, a default configuration is used.

If there's already one configuration, then it gets merged with the default.

_initialize_database(self)

source code 

Creates an initial database for BRisa. This database contains base sections and parameters with default values. Creating this through code is better than manually because it is better maintainable and the creation is automatic.