twobraids/configman — pull request #48 by twobraids (2011-11-22 21:41:01+00:00)
Title: Rework config

This is a proposal for a new interface for config files. It's lacking in unittests, but existing unittests all work. The demos have been refactored to reflect the new way of doing things.

major change to both the interface and implementation of config files:

1) 'admin.config_path' and 'admin.write' options are gone
2) new option 'admin.dump_conf': give it a pathname and configman will write out a file based on the file extension given in the pathname
3) new option 'admin.print_conf': give it a config file type (ini, json, conf) and configman will write the appropriate format to stdout
4) new option 'admin.conf': specify a full pathname of a config file to load
5) default value_source_list - most apps will want "config file; environment; commandline" so that's the default if not specified. demo1.py does this.
6) aliases for value_souces: it was awkward to make value source lists from lists of strings and modules. There's now aliases in configman.__init__.py. See demo2.py for an example.