Package lyntin :: Module config :: Class ConfigManager
[show private | hide private]
[frames | no frames]

Class ConfigManager

Manager --+
          |
         ConfigManager


Holds all the configuration pieces for Lyntin.
Method Summary
  __init__(self, e)
  add(self, name, configitem, ses)
Adds a new configuration item.
  addSession(self, newsession, basesession)
  change(self, name, newvalue, ses)
Changes the value of a configuration item and then (if successful), it spams the config_change_hook with the session (or None), name of the config item, the old value and the new value.
  get(self, name, ses, defaultvalue)
Gets a value for a config item.
ConfigBase getConfigItem(self, name, ses)
Retrieves a specific configuration item by name and session.
list of ConfigBase subclass objects getConfigItems(self, ses)
Returns all the configuration items for a given session.
  remove(self, name, ses)
Allows you to remove a configuration item from the system.
  removeSession(self, ses)
Tells the manager to remove information regarding the session.
    Inherited from Manager
  clear(self, ses)
Removes everything the manager was managing--essentially reinitializes it.
string getInfo(self, ses, text)
Returns information managed by this class.
list of mappings getInfoMappings(self, item, ses)
Returns a list of maps of parameter name -> value that represents all the info this manager is managing for this session.
list of strings getItems(self)
Returns a list of the items that this manager manages.
list of tuples getParameters(self, item)
Returns a list of tuples of the parameters we're storing in this manager and the description of each parameter.
string getStatus(self, ses)
Returns a one-liner status of the state of this manager for a given session.

Method Details

add(self, name, configitem, ses=None)

Adds a new configuration item.
Parameters:
name - the name of the item
           (type=string)
configitem - the configuration item to add
           (type=ConfigBase)
ses - if this item is session based, then this is the session to associate the item with
           (type=Session)
Raises:
ValueError - if we already have an item in that session with that name.

change(self, name, newvalue, ses=None)

Changes the value of a configuration item and then (if successful), it spams the config_change_hook with the session (or None), name of the config item, the old value and the new value.
Parameters:
name - the name of the item to change
           (type=string)
newvalue - the new value to change it to
           (type=varies (probably a string))
ses - the session (or None if this is not session-scoped)
           (type=Session)

get(self, name, ses=None, defaultvalue='No default value')

Gets a value for a config item. If the default value is not specified, then it will raise a ValueError.
Parameters:
name - the name of the item to retrieve the value of
           (type=string)
ses - the session (or None if this is not session-scoped)
           (type=Session)
defaultvalue - the value to return if there is no config item of that name. if you don't specify this, then we'll raise a ValueError.
           (type=varies)

getConfigItem(self, name, ses=None)

Retrieves a specific configuration item by name and session. If the ses passed in is None, then we look for lyntin general config items.
Parameters:
name - the name of the config item to retrieve
           (type=string)
ses - the session to retrieve the item from (or None if it's a global item)
           (type=Session)
Returns:
a ConfigBase item or None if the item doesn't exist
           (type=ConfigBase)

getConfigItems(self, ses=None)

Returns all the configuration items for a given session.
Parameters:
ses - the session to pull items for, or None if it's general Lyntin configuration stuff
           (type=Session)
Returns:
list of ConfigBase subclass objects
           (type=list of ConfigBase subclass objects)

remove(self, name, ses=None)

Allows you to remove a configuration item from the system.
Parameters:
name - the name of the item to remove
           (type=string)
ses - the session from which to remove the item (None if it's a general Lyntin item)
           (type=Session)
Raises:
ValueError - if the item does not exist

removeSession(self, ses)

Tells the manager to remove information regarding the session.
Parameters:
ses - the session we no longer need to hold information for because the session has gone away
           (type=Session)
Overrides:
lyntin.manager.Manager.removeSession (inherited documentation)

Generated by Epydoc 2.1 on Mon Aug 9 09:17:42 2004 http://epydoc.sf.net