Package svnmailer :: Package settings :: Module configfile :: Class FileConfig
[show private | hide private]
[frames | no frames]

Class FileConfig

object --+    
         |    
BaseConfig --+
             |
            FileConfig


Representation of the loaded config file
Method Summary
  __init__(self, settingsobj)
Initialization
  __delitem__(self, section)
Removes the specified section
  __iter__(self)
Iterator over the section names
  _attachIncludes(self, parsed, settingsobj, includes, mainfile)
Attaches the includes to the main config
_fileparser.FileParser _createFileParser(self)
Returns a new FileParser instance
_fileparser.Option _extractOption(self, section, option)
Returns the specified option or None
file _findConfig(self, settingsobj)
Finds and opens the main config file
list _getDefaultConfigFiles(self, settingsobj)
Returns the default config file locations
_fileparser.FileParser _loadConfig(self, settingsobj)
Load and parse main config file
str _optionxform(self, option)
Returns the transformed option
  _processPreOptions(self, parsed, settingsobj, name)
Processes the pre section options
  extractSection(self, section, xform, keep, check)
Returns the options of the specified section
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name...
  __getattribute__(...)
x.__getattribute__('name') <==> x.name...
  __hash__(x)
x.__hash__() <==> hash(x)...
  __reduce__(...)
helper for pickle...
  __reduce_ex__(...)
helper for pickle...
  __repr__(x)
x.__repr__() <==> repr(x)...
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value...
  __str__(x)
x.__str__() <==> str(x)...
    Inherited from type
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T...

Instance Variable Summary
_fileparser.FileParser _parsed: The _fileparser.FileParser instance
    Inherited from BaseConfig
str charset: Charset of the config file

Class Variable Summary
list __implements__ = [<class 'svnmailer.settings._base.BaseC...
str _CHARSETOPTION: Normalized name of the config_charset option
str _INCLUDEOPTION: Normalized name of the include_config option

Method Details

__init__(self, settingsobj)
(Constructor)

Initialization
Parameters:
settingsobj - The settings object
           (type=_base.BaseSettings)
Raises:
ConfigIOError - some configfile could not be opened
ConfigMissingError - see _findConfig
ValueError - Syntax Error detected or unicode failure in include_config preoption
ConfigInvalidError - some error occured while parsing the config
Overrides:
svnmailer.settings._base.BaseConfig.__init__

__delitem__(self, section)
(Index deletion operator)

Removes the specified section
Overrides:
svnmailer.settings._base.BaseConfig.__delitem__

__iter__(self)

Iterator over the section names
Overrides:
svnmailer.settings._base.BaseConfig.__iter__

_attachIncludes(self, parsed, settingsobj, includes, mainfile)

Attaches the includes to the main config
Parameters:
parsed - The parsed config
           (type=_fileparser.FileParser)
settingsobj - The settings object
           (type=_base.BaseSettings)
includes - Whitespace separated sequence of quoted strings where each represents a file name to include (this is the specification of the option value)
           (type=str)
mainfile - main config filename
           (type=str)
Raises:
ConfigIOError - Error reading an included file
ValueError - Syntax Error detected or unicode failure in includes
ConfigInvalidError - sectionless option in include file detected

_createFileParser(self)

Returns a new FileParser instance
Returns:
The FileParser instance
           (type=_fileparser.FileParser)

_extractOption(self, section, option)

Returns the specified option or None

All options of the section are scanned and transformed using _optionxform. The first matching option wins and is removed after retrieving the value.

Parameters:
section - The section to scan
           (type=_fileparser.Section)
option - The option name in question
           (type=str)
Returns:
The option
           (type=_fileparser.Option)

_findConfig(self, settingsobj)

Finds and opens the main config file
Parameters:
settingsobj - The settings object
           (type=_base.BaseSettings)
Returns:
The open descriptor
           (type=file)
Raises:
ConfigMissingError -

config neither specified nor on default locations found. Default locations are (tried in that order):

  • <repos>/conf/mailer.conf
  • <scriptdir>/mailer.conf
  • /etc/svn-mailer.conf
ConfigIOError - specified configfile could not be opened

_getDefaultConfigFiles(self, settingsobj)

Returns the default config file locations
Parameters:
settingsobj - The settings object
           (type=_base.BaseSettings)
Returns:
The list of config file locations
           (type=list)

_loadConfig(self, settingsobj)

Load and parse main config file
Parameters:
settingsobj - The settings object
           (type=_base.BaseSettings)
Returns:
The parsed config
           (type=_fileparser.FileParser)
Raises:
ConfigIOError - some configfile could not be opened
ConfigMissingError - see _findConfig
ValueError - Syntax Error detected or unicode failure in includes

_optionxform(self, option)

Returns the transformed option
Returns:
The normalized option
           (type=str)

_processPreOptions(self, parsed, settingsobj, name)

Processes the pre section options

These options are specified before the first section If there aren't any of such options specified, they are looked up in [general] (backwards compat).

Parameters:
parsed - The parsed config
           (type=_fileparser.FileParser)
settingsobj - The settings object
           (type=_base.BaseSettings)
name - The name of the main config file (used to determine relative includes)
           (type=basestring)
Raises:
ConfigIOError - Error reading an included file
ValueError - Syntax Error detected or unicode failure in includes
ConfigInvalidError - There are unknown options without a section

extractSection(self, section, xform=True, keep=False, check=True)

Returns the options of the specified section
Raises:
ConfigSectionNotFoundError - The section was not found
ConfigOptionUnknownError - A option name was invalid
Overrides:
svnmailer.settings._base.BaseConfig.extractSection

Instance Variable Details

_parsed

The _fileparser.FileParser instance
Type:
_fileparser.FileParser

Class Variable Details

__implements__

Type:
list
Value:
[<class 'svnmailer.settings._base.BaseConfig'>]                        

_CHARSETOPTION

Normalized name of the config_charset option
Type:
str
Value:
'config_charset'                                                       

_INCLUDEOPTION

Normalized name of the include_config option
Type:
str
Value:
'include_config'                                                       

Generated by Epydoc 2.0 on Sun Sep 25 20:49:02 2005 http://epydoc.sf.net