Package syspolicy :: Module policy :: Class Policy
[hide private]
[frames] | no frames]

Class Policy

source code

config.Config --+
                |
               Policy

This class extends the Config class to provide the policy functionality and meaning over a regular constant configuration object. This means that all the subsections are always expanded with the values from the default section recursively upon loading the policy.

Secondly, the get() function has been overridden so that the default value is returned if the specified subsection or attribute doesn't exist. The purpose of this behaviour is to always provide new groups with the default policy.

Instance Methods [hide private]
 
__init__(self, name, source=None, load=True, merge_default=False)
Initialize the Config class and load the configuration if `load` is True
source code
 
load(self, configfile=None, merge_default=False)
This function loads the policy from `configfile` and if `merge_default` is set to True, merges the default values into all the subsections as well.
source code
 
get(self, path=[])
This function is a short form for get_branch
source code

Inherited from config.Config: attributes, clear, compare_to, get_branch, print_all, save, sections, set

Class Variables [hide private]

Inherited from config.Config: data, name, source

Method Details [hide private]

__init__(self, name, source=None, load=True, merge_default=False)
(Constructor)

source code 

Initialize the Config class and load the configuration if `load` is True

Parameters:
  • name - The identifier name for the Config
  • source - Source file name where to load/save the configuration
  • load - Whether to load the configuration at start (default: True)
Overrides: config.Config.__init__
(inherited documentation)

load(self, configfile=None, merge_default=False)

source code 

This function loads the policy from `configfile` and if `merge_default` is set to True, merges the default values into all the subsections as well.

Parameters:
  • merge_default - Whether or not to merge the default values
Returns:
True if configuration was loaded, False otherwise
Overrides: config.Config.load

get(self, path=[])

source code 

This function is a short form for get_branch

Parameters:
  • path - The location of the branch to be returned
Returns:
Configuration branch at `path` or None.
Overrides: config.Config.get_branch