ConfigParser: whitespace leading comment lines

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gwillden@gmail.com

    #1

    ConfigParser: whitespace leading comment lines

    Hello all,
    I'd like to propose the following change to ConfigParser.py .
    I won't call it a bug-fix because I don't know the relevant standards.
    This change will enable multiline comments as follows:

    [section]
    item=value ;first of multiline comment
    ;second of multiline comment

    Right now the behaviour is

    In [19]: cfg.get('sectio n','item')
    Out[19]: 'value\n;second of multiline comment'

    It's a one-line change.
    RawConfigParser ._read lines 434-437
    # comment or blank line?
    - if line.strip() == '' or line[0] in '#;':
    + if line.strip() == '' or line.strip()[0] in '#;':
    continue

    Regards,
    Greg Willden

  • Fulvio

    #2
    Re: ConfigParser: whitespace leading comment lines

    *************** ********
    Your mail has been scanned by InterScan MSS.
    *************** ********


    On Friday 13 October 2006 04:13, gwillden@gmail. com wrote:
    I'd like to propose the following change to ConfigParser.py .
    IMO there's a reason that left it in such way.
    Whom didn't like the ConfigParser classes had made a new module, and I could
    find a the least 4 of them (cfgparse, config, configobj, pytconfpy).
    I choose ConfigParser because I'm very new and I haven't learn how to
    implement subclasses.
    I also will to use ConfigParser with some more feature like sub-options, but I
    didn't get that clue :(
    If you don't like that behavior easy you can override it in a subclass and use
    the way you prefer.

    F

    Comment

    Working...