Package Products :: Package ZenUtils :: Module config :: Class ConfigFile
[hide private]
[frames] | no frames]

Class ConfigFile

source code

object --+
         |
        ConfigFile


Parses Zenoss's config file format.

Example:

    key value
    key intvalue
    key = value
    key=value
    key:value
    key : value

Nested Classes [hide private]
_invalidLineType
Default line if no other ConfigLines matched.
Instance Methods [hide private]
 
__init__(self, file)
@param file file-like-object
source code
 
_parseLine(self, line) source code
 
_checkLine(self, line, lineno) source code
 
parse(self)
Parse a config file which has key-value pairs.Returns a list of config line information.
source code
 
write(self, file)
Write the config out to a file.
source code
 
validate(self)
Validate that there are no errors in the config file
source code
 
__iter__(self) source code
 
items(self) source code
Class Variables [hide private]
  _lineTypes = [SettingLine, CommentLine, EmptyLine,]
Method Details [hide private]

__init__(self, file)
(Constructor)

source code 

@param file file-like-object

Overrides: object.__init__

parse(self)

source code 

Parse a config file which has key-value pairs.Returns a list of config line information. This line information can be used to accuratly recreate the config without losing comments or invalid data.

write(self, file)

source code 

Write the config out to a file. Takes a new file argument because the input file object often doesn't have write access.

@param file file-like-object

validate(self)

source code 

Validate that there are no errors in the config file

@throws ConfigError