A loader implementing the PasteDeploy syntax to be used by plaster.
Project description
plaster_pastedeploy is a plaster plugin that provides a plaster.Loader that can parse ini files according to the standard set by PasteDeploy. It supports the wsgi plaster protocol, implementing the plaster.protocols.IWSGIProtocol interface.
Usage
Applications should use plaster_pastedeploy to load settings from named sections in a configuration source (usually a file).
Please look at the documentation for plaster on how to integrate this loader into your application.
Please look at the documentation for PasteDeploy on the specifics of the supported INI file format.
Most applications will want to use plaster.get_loader(uri, protocols=['wsgi']) to get this loader. It then exposes get_wsgi_app, get_wsgi_app_settings, get_wsgi_filter and get_wsgi_server.
import plaster
loader = plaster.get_loader('development.ini', protocols=['wsgi'])
# to get any section out of the config file
settings = loader.get_settings('app:main')
# to get settings for a WSGI app
app_config = loader.get_wsgi_app_settings() # defaults to main
# to get an actual WSGI app
app = loader.get_wsgi_app() # defaults to main
# to get a filter and compose it with an app
filter = loader.get_wsgi_filter('filt')
app = filter(app)
# to get a WSGI server
server = loader.get_wsgi_server() # defaults to main
# to start the WSGI server
server(app)
Any plaster.PlasterURL options are forwarded as defaults to the loader. Some examples are below:
development.ini#myapp
development.ini?http_port=8080#main
ini+pastedeploy:///path/to/development.ini
ini+pastedeploy://development.ini#foo
egg:MyApp?debug=false#foo
0.2.1 (2017-03-29)
Fix a bug in 0.2 in which an exception was raised for an invalid section if the a non-config-file-based protocol was used.
0.2 (2017-03-29)
No longer raise plaster.NoSectionError exceptions. Empty dictionaries are returned for missing sections and a user should check get_sections for the list of valid sections.
0.1 (2017-03-27)
Initial release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for plaster_pastedeploy-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bab3fd4cc298c021f115b531b9d6ae7678e185d9029c8c3411283e5f22d2bd46 |
|
MD5 | def0857ce653e0cb45b037f53cd368f2 |
|
BLAKE2b-256 | 41d1ddc6f68a4737fb67e3fedcfd7d772805f88d0f0443d18e734b14cbc49350 |
Hashes for plaster_pastedeploy-0.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53af71cc496674044943cf3a2ad5afdc5fcd410c335955228cc7a5569fddbf51 |
|
MD5 | a54b3ee79710428b1aaee6f152e00539 |
|
BLAKE2b-256 | acf0dc6979cf1d76558ccf6a4654db031c6b92ed74bf5bcd799d8eeb8a972298 |