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

Class ConfigBase

Known Subclasses:
BoolConfig, CharConfig, IntConfig, StringConfig

A ConfigDataBase subclass encapsulates a piece of configuration. It encapsulates its type functionality (data checking, et al), its name and its value.
Method Summary
  __init__(self, name, originalvalue, persist, description)
Sets the name and original value.
varies check(self, value)
Checks the value to verify that it's a valid value for this config data item.
varies get(self)
Retrieves the value in question.
string getDescription(self)
Gets the description of the config item.
varies set(self, newvalue)
Sets the value.
string toString(self)
Retrieves a textual representation of the value and the type of the config item.

Method Details

__init__(self, name, originalvalue, persist, description)
(Constructor)

Sets the name and original value. Override this if you need additional pieces of information in your ConfigDataBase subclass.
Parameters:
name - the name of the config item
           (type=string)
originalvalue - the original value of the config item
           (type=varies)
persist - this config item should (1) or should not (0) persist via the write command
           (type=boolean)
description - a short explanation of what this config item is.
           (type=string)

check(self, value)

Checks the value to verify that it's a valid value for this config data item. Override this so that it checks the incoming value and if it's not a valid type, it kicks up a TypeError. If it's not a valid value (different than not being a valid type) it kicks up a ValueError. If everything is ok, it should return the converted argument.
Parameters:
value - the value to check (and convert)
           (type=string)
Returns:
the converted value if everything is kosher
           (type=varies)
Raises:
TypeError - if it's not a valid type
ValueError - if it's not a valid value

get(self)

Retrieves the value in question.
Returns:
the value we're holding
           (type=varies)

getDescription(self)

Gets the description of the config item.
Returns:
the description of the config item
           (type=string)

set(self, newvalue)

Sets the value. This should check the value first, and then set it if it's ok.

Override this if you need to provide additional functionality.
Parameters:
newvalue - the new value to set
           (type=varies)
Returns:
the old value (actual value)
           (type=varies)

toString(self)

Retrieves a textual representation of the value and the type of the config item.
Returns:
string
           (type=string)

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