Application environment class. This holds information about the application environment loaded from an application preference file of the name .application-name which is searched for in the following locations:
The users home directory (as defined by the HOME environment variable).
Each of the non-empty directories in the sys.path variable (doesn't look in the current directory).
This class implements the dictionary interface for variable access.
def __getitem__(self, item):
def __init__(self, appName):
Constructs an AppEnv instance. appName should be a string application
name, mainModule should be the location of the main module.
Gets the application environment variable identified by key. If this
value is not currently among the application variables, returns default.
Gets the application environment variable identified by key. If this
variable is not defined, or is defined as an empty or all whitespace string,
raises a KeyError.
If the value is defined, all whitespace will be stripped from the end end
beginning of it.
Returns true (1) if the variable file was loaded, false (0) if not.
Saves the environment file. If the file was not already loaded or specified
through the setPath() method, the file will be written
to the home directory or (if it does not exist) the first non-empty directory in
sys.path.
Sets the variable file path. The variable file will be constructed from
path and the application name.
Writes the file representation of the environment to the given file.
__setitem__(self, item, val)
def __setitem__(self, item, val):
_findEnvFile(self)
def _findEnvFile(self):
get(self, key, default)
def get(self, key, default):
getStrict(self, key)
def getStrict(self, key):
has_key(self, key)
def has_key(self, key):
loaded(self)
def loaded(self):
save(self)
def save(self):
setPath(self, path)
def setPath(self, path):
writeTo(self, file)
def writeTo(self, file):