l.s.c.LaunchpadConfig : class documentation

Part of lp.services.config View In Hierarchy

Singleton configuration, accessed via the config module global.

Cached copies are kept in thread locals ensuring the configuration is thread safe (not that this will be a problem if we stick with simple configuration).

Method __init__ Create a new instance of LaunchpadConfig.
Method instance_name Return the config's instance name.
Method config_dir Return the directory containing this instance configuration.
Method setInstance Set the instance name where the conf files are stored.
Method reloadConfig Reload the config.
Method isTestRunner Return true if the current config is a 'testrunner' config.
Method process_name Return or set the current process's name to select a conf.
Method setProcess Set the name of the process to select a conf file.
Method zope_config_file Return the path to the ZConfig file for this instance.
Method generate_overrides Ensure correct config.zcml overrides will be called.
Method appserver_root_url Return the correct app server root url for the given facet.
Method __getattr__ Undocumented
Method __contains__ Undocumented
Method __getitem__ Undocumented
Method __dir__ List section names in addition to methods and variables.
Method __iter__ Iterate through configuration sections.
Method _make_process_name Undocumented
Method _invalidateConfig Invalidate the config, causing the config to be regenerated.
Method _getConfig Get the schema and config for this environment.
Method _loadConfigOverlays Apply config overlays from the launchpad.config_overlay_dir.
Method _setZConfig Modify the config, adding automatically generated settings
def __init__(self, instance_name=None, process_name=None):
Create a new instance of LaunchpadConfig.
Parametersinstance_namethe configuration instance to use. Defaults to the value of the LPCONFIG environment variable.
process_namethe process configuration name to use. Defaults to the basename of sys.argv[0] without any extension, or None if sys.argv is not available.
def _make_process_name(self):
Undocumented
@property
def instance_name(self):
Return the config's instance name.

This normally corresponds to the LPCONFIG environment variable. It is also the name of the directory the conf file is loaded from.

@property
def config_dir(self):
Return the directory containing this instance configuration.
def setInstance(self, instance_name):
Set the instance name where the conf files are stored.

This method is used to set the instance_name, which is the directory where the conf file is stored. The test runner uses this to switch on the test configuration. This method also sets the LPCONFIG environment variable so subprocesses keep the same default.

def _invalidateConfig(self):
Invalidate the config, causing the config to be regenerated.
def reloadConfig(self):
Reload the config.
def isTestRunner(self):
Return true if the current config is a 'testrunner' config.

That is, if it is the testrunner config, or a unique variation of it, but not if its the testrunner-appserver, development or production config.

@property
def process_name(self):
Return or set the current process's name to select a conf.

LaunchpadConfig loads the conf file named for the process. When the conf file does not exist, it loads launchpad-lazr.conf instead.

def setProcess(self, process_name):
Set the name of the process to select a conf file.

This method is used to set the process_name if it should be different from the name obtained from sys.argv[0]. LaunchpadConfig will try to load <process_name>-lazr.conf if it exists. Otherwise, it will load launchpad-lazr.conf.

def _getConfig(self):
Get the schema and config for this environment.

The config is will be loaded only when there is not a config. Repeated calls to this method will not cause the config to reload.

def _loadConfigOverlays(self, config_file):
Apply config overlays from the launchpad.config_overlay_dir.
@property
def zope_config_file(self):
Return the path to the ZConfig file for this instance.
def _setZConfig(self):
Modify the config, adding automatically generated settings
def generate_overrides(self):
Ensure correct config.zcml overrides will be called.

Call this method before letting any ZCML processing occur.

def appserver_root_url(self, facet='mainsite', ensureSlash=False):
Return the correct app server root url for the given facet.
def __getattr__(self, name):
Undocumented
def __contains__(self, key):
Undocumented
def __getitem__(self, key):
Undocumented
def __dir__(self):
List section names in addition to methods and variables.
def __iter__(self):
Iterate through configuration sections.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.