ConfigParser Keys

Peter Otten __peter__ at web.de
Mon Jun 21 09:26:06 EDT 2004


Neil Benn wrote:

>           To my chagrin, I've just discovered that SafeConfigParser, by
> default, returns all the keys in the key/value pairing in lowercase
> (what earthly possible reason it would do this I do not know!).  Does

The config file may be edited by a non-programmer. It is a safe assumption
that he will expect KEY=value, key=value and Key=value to affect the same
option.

> anyone know of a way of stopping it doing this?

Untested:

class CaseSensitiveSafeOptionParser(SafeOptionParser):
    def optionxform(self, optionstr):
        return optionstr

Peter




More information about the Python-list mailing list