Package svnmailer :: Module config :: Class ConfigFileSettings
[hide private]

Class ConfigFileSettings

source code

       object --+    
                |    
settings.Settings --+
                    |
                   ConfigFileSettings

Provide settings from config

Instance Methods [hide private]
 
init(self, *args, **kwargs)
Implements the init method of settings.Settings
source code
 
_init(self, options)
Actual implementation of self.init()
source code
 
_initGroups(self)
Initializes the Group config
source code
dict
_getDefaultGroupDict(self, container)
Returns the default group dict
source code
svnmailer.settings.GroupSettingsContainer
_getGroupDefaults(self)
Returns the default groups container
source code
 
_initGeneral(self)
Initializes the general config
source code
 
_initRuntime(self, options)
Initializes the runtime from options
source code
 
_passConfig(self, container, section)
Passes the options to the specified container
source code
ConfigParser.ConfigParser
_loadConfig(self)
Parse config file
source code
ConfigParser.ConfigParser
_createConfigParser(self)
Returns a ConfigParser instance
source code
file like object
_findConfig(self, _file=<type 'file'>)
Finds and opens the main config file
source code
 
_applyMaps(self)
Resolves all map definitions
source code
callable
_getPlainMap(self, section)
Returns a plain map for a particular section
source code
 
_applyIncludes(self, origfile, _file=<type 'file'>)
Applies the includes found in [general]
source code
 
_applyCharset(self)
Applies the charset found in [general]
source code
list
_getDefaultConfigFiles(self, _os=<module 'os' from '/usr/lib64/python2.7/os.pyc'>, _sys=<module 'sys' (built-in)>)
Returns the default config files
source code

Inherited from settings.Settings: __init__, getDefaultGroupContainer, getGeneralContainer, getGroupContainer, getRuntimeContainer

Inherited from settings.Settings (private): _checkInitialization, _getArgs

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __implements__ = [<class 'svnmailer.settings.Settings'>]
str MAPSECTION = 'maps'
The mapping section name; if None, mapping is effectively disabled
Instance Variables [hide private]
ConfigParser.ConfigParser _config
The config object

Inherited from settings.Settings: _charset_, _maps_, debug, general, groups, runtime

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

init(self, *args, **kwargs)

source code 

Implements the init method of settings.Settings

Raises:
Overrides: settings.Settings.init

_init(self, options)

source code 

Actual implementation of self.init()

Parameters:
  • options (optparse.OptionParser) - runtime options
Raises:

_getDefaultGroupDict(self, container)

source code 

Returns the default group dict

Parameters:
  • container (svnmailer.settings.GroupSettingsContainer) - The default container
Returns: dict
The default dict

_getGroupDefaults(self)

source code 

Returns the default groups container

Returns: svnmailer.settings.GroupSettingsContainer
The defaults (groupcontainer without maps)

_initGeneral(self)

source code 

Initializes the general config

Raises:

_initRuntime(self, options)

source code 

Initializes the runtime from options

Parameters:
  • options (optparse.OptionParser) - runtime options

_passConfig(self, container, section)

source code 

Passes the options to the specified container

Parameters:
  • container (svnmailer.util.Struct) - The container object
  • section (str) - The config section name
Raises:
  • ConfigSectionNotFoundError - The specified section was not found in the config file
  • ConfigOptionUnkownError - There was an unknown config option in the config file.

_loadConfig(self)

source code 

Parse config file

Returns: ConfigParser.ConfigParser
parsed config
Raises:

_createConfigParser(self)

source code 

Returns a ConfigParser instance

Returns: ConfigParser.ConfigParser
The ConfigParser instance

_findConfig(self, _file=<type 'file'>)

source code 

Finds and opens the main config file

Parameters:
  • _file (callable) - The function to open the file
Returns: file like object
The open descriptor
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
  • ConfigNotFoundError - specified configfile could not be opened

_applyMaps(self)

source code 

Resolves all map definitions

Raises:

To Do: raise an error on unknown options

_getPlainMap(self, section)

source code 

Returns a plain map for a particular section

Parameters:
  • section (str) - The mapping section
Returns: callable
The mapping function
Raises:

_applyIncludes(self, origfile, _file=<type 'file'>)

source code 

Applies the includes found in [general]

Parameters:
  • origfile (str) - original filename
  • _file (callable) - The function to open the file
Raises:

_getDefaultConfigFiles(self, _os=<module 'os' from '/usr/lib64/python2.7/os.pyc'>, _sys=<module 'sys' (built-in)>)

source code 

Returns the default config files

Returns: list
The list