ConfigParser Keys

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Neil Benn

    ConfigParser Keys

    Hello,

    To my chagrin, I've just discovered that SafeConfigParse r, 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
    anyone know of a way of stopping it doing this?

    Cheers,

    Neil

    --

    Neil Benn
    Senior Automation Engineer
    Cenix BioScience
    BioInnovations Zentrum
    Tatzberg 47
    D-01307
    Dresden
    Germany

    Tel : +49 (0)351 4173 154
    e-mail : benn@cenix-bioscience.com
    Cenix Website : http://www.cenix-bioscience.com


  • Peter Otten

    #2
    Re: ConfigParser Keys

    Neil Benn wrote:
    [color=blue]
    > To my chagrin, I've just discovered that SafeConfigParse r, 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[/color]

    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.
    [color=blue]
    > anyone know of a way of stopping it doing this?[/color]

    Untested:

    class CaseSensitiveSa feOptionParser( SafeOptionParse r):
    def optionxform(sel f, optionstr):
    return optionstr

    Peter

    Comment

    Working...