Package svnmailer :: Module config :: Class ConfigFileSettings
[show private | hide private]
[frames | no frames]

Type ConfigFileSettings

object --+    
         |    
  Settings --+
             |
            ConfigFileSettings


Provide settings from config
Method Summary
  init(self, *args, **kwargs)
Implements the init method of settings.Settings
  _applyCharset(self)
Applies the charset found in [general]
  _applyIncludes(self, origfile, _file)
Applies the includes found in [general]
  _applyMaps(self)
Resolves all map definitions
ConfigParser.ConfigParser _createConfigParser(self)
Returns a ConfigParser instance
file like object _findConfig(self, _file)
Finds and opens the main config file
list _getDefaultConfigFiles(self, _os, _sys)
Returns the default config files
dict _getDefaultGroupDict(self, container)
Returns the default group dict
svnmailer.settings.GroupSettingsContainer _getGroupDefaults(self)
Returns the default groups container
callable _getPlainMap(self, section)
Returns a plain map for a particular section
  _init(self, options)
Actual implementation of self.init()
  _initGeneral(self)
Initializes the general config
  _initGroups(self)
Initializes the Group config
  _initRuntime(self, options)
Initializes the runtime from options
ConfigParser.ConfigParser _loadConfig(self)
Parse config file
  _passConfig(self, container, section)
Passes the options to the specified container
    Inherited from Settings
  __init__(self, *args, **kwargs)
Constructor
GroupSettingsContainer getDefaultGroupContainer(self, **kwargs)
Returns an initialized default group settings container
GeneralSettingsContainer getGeneralContainer(self, **kwargs)
Returns an initialized general settings container
GroupSettingsContainer getGroupContainer(self, **kwargs)
Returns an initialized group settings container
RuntimeSettingsContainer getRuntimeContainer(self, **kwargs)
Returns an initialized runtime settings container
  _checkInitialization(self)
Checks if all containers are filled
list _getArgs(self)
Returns the basic arguments for container initialization
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name...
  __getattribute__(...)
x.__getattribute__('name') <==> x.name...
  __hash__(x)
x.__hash__() <==> hash(x)...
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T...
  __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)...

Instance Variable Summary
ConfigParser.ConfigParser _config: The config object
    Inherited from Settings
str _charset_: The charset used for settings recoding
dict _maps_: The value mappers to use or None
bool debug: Debug state
GeneralSettingsContainer general: General settings
list of GroupSettingsContainer groups: group settings list
RuntimeSettingsContainer runtime: Runtime settigs

Class Variable Summary
list __implements__ = [<class 'svnmailer.settings.Settings'>]
str MAPSECTION: The mapping section name; if None, mapping is effectively disabled

Method Details

init(self, *args, **kwargs)

Implements the init method of settings.Settings
Raises:
ConfigInvalidError - invalid config options
ConfigMissingError - see _loadConfig
ConfigNotFoundError - see _loadConfig
ConfigSectionNotFoundError - see _passConfig
ConfigOptionUnkownError - see _passConfig
ConfigMappingSpecInvalidError - see _applyMaps
ConfigMappingSectionNotFoundError - see _getPlainMap
Overrides:
svnmailer.settings.Settings.init

_applyCharset(self)

Applies the charset found in [general]

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

Applies the includes found in [general]
Parameters:
origfile - original filename
           (type=str)
_file - The function to open the file
           (type=callable)
Raises:
ConfigNotFoundError - Error reading an included file

_applyMaps(self)

Resolves all map definitions
Raises:
ConfigMappingSpecInvalidError - The mapping spec was invalid
ConfigMappingSectionNotFoundError - see _getPlainMap

To Do: raise an error on unknown options

_createConfigParser(self)

Returns a ConfigParser instance
Returns:
The ConfigParser instance
           (type=ConfigParser.ConfigParser)

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

Finds and opens the main config file
Parameters:
_file - The function to open the file
           (type=callable)
Returns:
The open descriptor
           (type=file like object)
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

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

Returns the default config files
Returns:
The list
           (type=list)

_getDefaultGroupDict(self, container)

Returns the default group dict
Parameters:
container - The default container
           (type=

svnmailer.settings.GroupSettingsContainer)

Returns:
The default dict
           (type=dict)

_getGroupDefaults(self)

Returns the default groups container
Returns:
The defaults (groupcontainer without maps)
           (type=svnmailer.settings.GroupSettingsContainer)

_getPlainMap(self, section)

Returns a plain map for a particular section
Parameters:
section - The mapping section
           (type=str)
Returns:
The mapping function
           (type=callable)
Raises:
ConfigMappingSectionNotFoundError - The specified section was not found

_init(self, options)

Actual implementation of self.init()
Parameters:
options - runtime options
           (type=optparse.OptionParser)
Raises:
ConfigMissingError - see _loadConfig
ConfigNotFoundError - see _loadConfig
ConfigSectionNotFoundError - see _passConfig
ConfigOptionUnkownError - see _passConfig
ConfigMappingSpecInvalidError - see _applyMaps
ConfigMappingSectionNotFoundError - see _getPlainMap

_initGeneral(self)

Initializes the general config
Raises:
ConfigSectionNotFoundError - [general] not found

_initGroups(self)

Initializes the Group config

_initRuntime(self, options)

Initializes the runtime from options
Parameters:
options - runtime options
           (type=optparse.OptionParser)

_loadConfig(self)

Parse config file
Returns:
parsed config
           (type=ConfigParser.ConfigParser)
Raises:
ConfigNotFoundError - some configfile could not be opened
ConfigMissingError - see _findConfig
ConfigMappingSpecInvalidError - see _applyMaps
ConfigMappingSectionNotFoundError - see _getPlainMap

_passConfig(self, container, section)

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

Instance Variable Details

_config

The config object
Type:
ConfigParser.ConfigParser

Class Variable Details

__implements__

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

MAPSECTION

The mapping section name; if None, mapping is effectively disabled
Type:
str
Value:
'maps'                                                                 

Generated by Epydoc 2.1 on Mon Apr 17 12:39:11 2006 http://epydoc.sf.net