|
From: Michael H. <ma...@ma...> - 2009-12-11 14:26:00
|
I find the ConfigObj together with validation, type conversion and default generation extremely useful - in theory. I hope I dont overlook something obvious, but after putting in a day to coerce ConfigObj to do what I want I need to post this. Here is why: I have an application like many others - commandline arguments, environment, internal variables and all. I *would* like to use ConfigObj to handle some limited object persistence together with validate, type conversion and to generate default .ini files. Some of the persistent strings will be format strings referring to internal program variables, and I would like to get them uninterpolated - that I do myself. For some reason there seems to be a built-in assumption in ConfigObj as follows: - Interpolation just has to happen even during validation, ConfigParser-style and no way to turn that off. - and it just has to be against other variables in the DEFAULT section, which is a fairly limiting concept of interpolation. Here is an example: The spec is: axis3_safe_margin = string(default= "%(ax3_letter)s safety margin [mm]:") The task is: - if the default ini file does not exist, generate it from the spec. - when reading the default .ini back in, I want the string equivalent as generated by: <foo>.axis3_safe_margin = "%(ax3_letter)s safety margin [mm]:" ---------------------------^^^^^^^^^^^^^ note - no mutilation here Am I missing something here? The way this stands means for me: - validation cant be used, hence no automatic type conversion and default generation - this means I have to use ConfigObj without validate() which means I could pretty much stay with ConfigParser in the first place. pleaaaaaaasse - provide a way to turn of this interpolation !$"!% if one doesnt want/need it my suggestion: an interpolation=(True|False) parameter to validate() and please leave my strings untouched... thanks un advance Michael |