l.s.config : package documentation

Part of lp.services

Configuration information pulled from launchpad.conf.

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

Module fixture Fixtures related to configs.
Package tests No package docstring; 4/5 modules documented

From the __init__.py module:

Class DatabaseConfig A class to provide the Launchpad database configuration.
Class DatabaseConfigOverrides Undocumented
Class LaunchpadConfig Singleton configuration, accessed via the config module global.
Function commalist ZConfig validator for a comma separated list
Function find_config_dir Look through CONFIG_ROOT_DIRS for instance_name.
Function find_instance_name Undocumented
Function loglevel ZConfig validator for log levels.
Function url ZConfig validator for urls
Function urlbase ZConfig validator for url bases
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.