Configuration
=============
Class for generate a virtual configuration dictionnary from multiple
configuration file
Register a configuration file:
------------------------------
For register a configuration file you need to create an instance of
Configuration class.
Next you can add a configuration file with the method 'add_conf_file'.
This method take 1 parameter, the path of the file.
Warning: be careful with the path. It's better to give an absolute path than a
relative path::
>>> import os
>>> from emencia.ecsconfiguration import Configuration
>>> conf = Configuration()
>>> conf.add_conf_file(os..path.realpath("%s/doc/test_conf.conf" % PREFIX)
You can also add manualy a couple key, value with the method 'add_info'::
>>> conf.add_info('my_key','my_data')
Get data from the configuration module:
---------------------------------------
You can get a specific value with the 'get' method. It's better to check if
the key is present in the memory with the 'has_info' before try to access it.::
>>> conf = Configuration()
>>> if conf.has_info('book.title'):
... print conf.get('book.title')
'My Great Book'
If you want use all datas from the configuration you can use the "keys"
method. Like the dict's keys method, it returns a tuple with all keys.::
>>> conf = Configuration()
>>> for key in conf.keys()
... print "The key: %s, value: %s" % (key, conf.get(key))