|
From: Pettit, K. (SAIC) <Kei...@bp...> - 2007-09-13 18:13:04
|
Got ya. I'm pretty sure I'll have to hack through something to make it = happen but I do have a suggestion for development that would help with = this. The "merge" command would be perfect if in a future version it could = allow for these type of options in the config. foo1 =3D bar #Normal Way foo2 =3D=3D bar #Makes it immutable so a merge would still use this = value foo3 +=3D bar #Prepends option in merge foo4 +=3D bar #Appends option in merge Of course the =3D=3D,+=3D,=3D+ would only matter if your were doing a = "merge" but it would be very useful I'd imagine. Thanks, Keith -----Original Message----- From: con...@li... on behalf of = Michael Foord Sent: Thu 9/13/2007 12:57 PM To: con...@li... Subject: Re: [Configobj-develop] [python] Multiple layers of config = files help =20 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. > =20 Hello Keith, Sorry for the late reply, I've been 'conferencing' for the last week.=20 All conferenced out now. ConfigObj doesn't have any native support for the sort of thing you are=20 asking, *except* that you can 'merge' configobj instances over the top=20 of one another. The usual way to handle this sort of thing is to start with your=20 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=20 '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 > > =20 -------------------------------------------------------------------------= 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 |