HappyDoc Generated Documentation Class: ConfigFile

wifi-radar.py / ConfigFile 

Manage the configuration for the application, including reading and writing the config from/to a file.

Methods   
  set_opt 
set_opt (
        self,
        option_path,
        value,
        )

Set a config option while handling exceptions.

Parameters:

option_path
string - Section (a.k.a. profile) name concatenated with a period and the option key. (E.g. "DEFAULT.interface")
value
string - Value to set.

Returns:

nothing

  get_opt 
get_opt ( self,  option_path )

Get a config option and handle exceptions.

Parameters:

option_path
string - Section (a.k.a. profile) name concatenated with a period and the option key. (E.g. "DEFAULT.interface")

Returns:

string or None - option value as string or None on failure

  set_section 
set_section (
        self,
        section_name,
        section_dict,
        )

Set the contents of a section to values from a dictionary.

Parameters:

section_name
string - Configuration file section.
section_dict
dictionary - Values to add to section.

Returns:

nothing

  set_float_opt 
set_float_opt (
        self,
        option_path,
        value,
        )

Convert float type to string and set config option.

Parameters:

option_path
string - Section (a.k.a. profile) name concatenated with a period and the option key. (E.g. "DEFAULT.interface")
value
float - Value to set.

Returns:

nothing

Exceptions   

ValueError, 'value is not a float'

  set_int_opt 
set_int_opt (
        self,
        option_path,
        value,
        )

Convert integer type to string and set config option.

Parameters:

option_path
string - Section (a.k.a. profile) name concatenated with a period and the option key. (E.g. "DEFAULT.interface")
value
integer - Value to set.

Returns:

nothing

Exceptions   

ValueError, 'value is not an integer'

  profiles 
profiles ( self )

Return a list of the section names which denote AP profiles.

Parameters:

nothing

Returns:

list - profile names

  write 
write ( self )

Write configuration file to disk from instance variables. Copied from ConfigParser and modified to write options in alphabetical order.

Parameters:

nothing

Returns:

nothing

  set_bool_opt 
set_bool_opt (
        self,
        option_path,
        value,
        )

Convert boolean type to string and set config option.

Parameters:

option_path
string - Section (a.k.a. profile) name concatenated with a period and the option key. (E.g. "DEFAULT.interface")
value
boolean - Value to set.

Returns:

nothing

Exceptions   

ValueError, 'cannot convert value to string'

  read 
read ( self )

Read configuration file from disk into instance variables.

Parameters:

nothing

Returns:

nothing

  get_opt_as_bool 
get_opt_as_bool ( self,  option_path )

Get a config option and return as a boolean type.

Parameters:

option_path
string - Section (a.k.a. profile) name concatenated with a period and the option key. (E.g. "DEFAULT.interface")

Returns:

boolean - option value as boolean

Exceptions   

ValueError, 'boolean option was not True or False'

  get_opt_as_int 
get_opt_as_int ( self,  option_path )

Get a config option and return as an integer type.

Parameters:

option_path
string - Section (a.k.a. profile) name concatenated with a period and the option key. (E.g. "DEFAULT.interface")

Returns:

integer- option value as integer

  __init__ 
__init__ (
        self,
        filename,
        defaults,
        raw=None,
        )

Create a new ConfigFile.

Parameters:

filename
string - The configuration file's name.
defaults
dictionary - Default values for the DEFAULT section.

Returns:

ConfigFile instance

  get_profile 
get_profile ( self,  section_name )

Return the profile recorded in the specified section.

Parameters:

section_name
string - Configuration file section.

Returns:

dictionary or None - The specified profile or None if not found


This document was automatically generated Thu May 21 05:32:36 2009 by HappyDoc version 3.1