|
From: Michael F. <mi...@vo...> - 2007-09-13 17:59:41
|
Pettit, Keith (SAIC) wrote: > I'm working on a app that has multiple levels of configuration. I'm a newbie with configobj so I want to see if there is a better way to do this that what I'm thinking of. > > The levels of configs I need to have: > > Global - I'm using a spec file to set global values > Site - Site level > User - User level options > Project - Project level options > CLI - I'm using optparse right now > > With my options it goes top down starting from global, ending at Project now until I can figure out how to integrate with optparse. Here is the problem I need to solve with configobj: > > * I need the ability to set any of my [key] values as immutable in any of the config files from Global to Project. So I need to give the ability in the Global, Site, User, and Project config's to set any of the [key] values as immutable, which would means the config's below that can't change the value that was just set. > > * I need the ability to set whether a list or string in the config can be appended or reset by the next config in the line. > > * As a end result I need a final config after it has gone through the Global, Site, User, Project, options as well as obeyed the rules from the two above options I'd like to set. > Hello Keith, Sorry for the late reply, I've been 'conferencing' for the last week. All conferenced out now. ConfigObj doesn't have any native support for the sort of thing you are asking, *except* that you can 'merge' configobj instances over the top of one another. The usual way to handle this sort of thing is to start with your defaults and then merge the user ones over the top. This doesn't handle your requirements for sometimes restricting what can be overridden and what can't. In this case I suggest you do your own 'validation' type steps in between merging, working out which values you want to protect and then restoring them after the merge. I hope this helps. All the best, Michael Foord http://www.manning.com/foord > > Any suggestions or help on how to do this would be appreciated. > > Thanks, > > Keith > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > > |