l.s.c.__init__ : module documentation

Part of lp.services.config

Configuration information pulled from launchpad.conf.

The configuration section used is specified using the LPCONFIG environment variable, and defaults to 'development'

Function find_instance_name Undocumented
Function find_config_dir Look through CONFIG_ROOT_DIRS for instance_name.
Class LaunchpadConfig Singleton configuration, accessed via the config module global.
Function url ZConfig validator for urls
Function urlbase ZConfig validator for url bases
Function commalist ZConfig validator for a comma separated list
Function loglevel ZConfig validator for log levels.
Class DatabaseConfigOverrides Undocumented
Class DatabaseConfig A class to provide the Launchpad database configuration.
def find_instance_name():
Undocumented
def find_config_dir(instance_name):
Look through CONFIG_ROOT_DIRS for instance_name.
def url(value):

ZConfig validator for urls

We enforce the use of protocol.

>>> url('http://localhost:8086')
'http://localhost:8086'
>>> url('im-a-file-but-not-allowed')
Traceback (most recent call last):
    [...]
ValueError: No protocol in URL
def urlbase(value):
ZConfig validator for url bases

url bases are valid urls that can be appended to using urlparse.urljoin.

url bases always end with '/'

>>> urlbase('http://localhost:8086')
'http://localhost:8086/'
>>> urlbase('http://localhost:8086/')
'http://localhost:8086/'

URL fragments, queries and parameters are not allowed

>>> urlbase('http://localhost:8086/#foo')
Traceback (most recent call last):
    [...]
ValueError: URL fragments not allowed
>>> urlbase('http://localhost:8086/?foo')
Traceback (most recent call last):
    [...]
ValueError: URL query not allowed
>>> urlbase('http://localhost:8086/;blah=64')
Traceback (most recent call last):
    [...]
ValueError: URL parameters not allowed

We insist on the protocol being specified, to avoid dealing with defaults
>>> urlbase('foo')
Traceback (most recent call last):
    [...]
ValueError: No protocol in URL

File URLs specify paths to directories

>>> urlbase('file://bork/bork/bork')
'file://bork/bork/bork/'
def commalist(value):
ZConfig validator for a comma separated list
def loglevel(value):

ZConfig validator for log levels.

Input is a string ('info','debug','warning','error','fatal' etc. as per logging module), and output is the integer value.

>>> import logging
>>> loglevel("info") == logging.INFO
True
>>> loglevel("FATAL") == logging.FATAL
True
>>> loglevel("foo")
Traceback (most recent call last):
...
ValueError: ...
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.