| |
- util.AppEnv.AppEnv
class AppEnv |
|
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. |
|
Methods defined here:
- __getitem__(self, item)
- __init__(self, appName)
- Constructs an AppEnv instance. /appName/ should be a string application
name, /mainModule/ should be the location of the main module.
- __setitem__(self, item, val)
- get(self, key, default)
- Gets the application environment variable identified by /key/. If
this value is not currently among the application variables, returns
/default/.
- getStrict(self, key)
- 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.
- has_key(self, key)
- loaded(self)
- Returns true (1) if the variable file was loaded, false (0) if not.
- save(self)
- 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.
- setPath(self, path)
- Sets the variable file path. The variable file will be constructed from
/path/ and the application name.
- writeTo(self, file)
- Writes the file representation of the environment to the given /file/.
Data and other attributes defined here:
- identRx = <_sre.SRE_Pattern object at 0x401e4aa0>
| |