[Paul Moore] > * No way to merge files or sections. Usually to provide default > values. I have a suite of applications, all using the same framework. > I have a hardcoded DEFAULT_CONFIG in the code, overriden by a > <suite>.ini, overridden again by a <app>.ini. OK, maybe it's > overengineered, but I do use the various levels, so it's also > useful... (The defaults parameter to the constructor is misnamed, > AFAICT, as it's for interpolation defaults, not value defaults).
Why doesn't this work? It does here: $ cat suite.ini [sect] opt1 = 1 opt2 = 2 $ cat app.ini [sect] opt1 = 3 opt4 = 5 $ python Python 2.4.1 (#2, Mar 31 2005, 00:05:10) [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import ConfigParser >>> c = ConfigParser.ConfigParser() >>> c.read(("suite.ini", "app.ini")) ['suite.ini', 'app.ini'] >>> c.sections() ['sect'] >>> c.options("sect") ['opt4', 'opt2', 'opt1'] >>> c.get("sect", "opt1") '3' Or do you mean something else? =Tony.Meyer _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com