Package translate :: Package misc :: Module ini

[hide private]
[frames] | no frames]

# Module ini

source code

Access and/or modify INI files

* Compatiable with ConfigParser * Preserves order of sections & options * Preserves comments/blank lines/etc * More convenient access to data

Example:

    >>> from StringIO import StringIO
    >>> sio = StringIO('''# configure foo-application
    ... [foo]
    ... bar1 = qualia
    ... bar2 = 1977
    ... [foo-ext]
    ... special = 1''')

    >>> cfg = INIConfig(sio)
    >>> print cfg.foo.bar1
    qualia
    >>> print cfg['foo-ext'].special
    1
    >>> cfg.foo.newopt = 'hi!'

    >>> print cfg
    # configure foo-application
    [foo]
    bar1 = qualia
    bar2 = 1977
    newopt = hi!
    [foo-ext]
    special = 1

Classes | [hide private]

| LineType
| SectionLine
| OptionLine
| CommentLine
| EmptyLine
| ContinuationLine
| LineContainer
| INISection
| INIConfig

Functions | [hide private]

_make_xform_property(myattrname, srcattrname=None) | source code

make_comment(line) | source code

readline_iterator(f) iterate over a file by only using the file object's readline method | source code