wuttaweb.app

Application

class wuttaweb.app.WebAppProvider(config)[source]

The app provider for WuttaWeb. This adds some methods to the app handler, which are specific to web apps.

get_web_handler(**kwargs)[source]

Get the configured “web” handler for the app.

Specify a custom handler in your config file like this:

[wutta]
web.handler_spec = poser.web.handler:PoserWebHandler
Returns:

Instance of WebHandler.

wuttaweb.app.main(global_config, **settings)[source]

This function returns a Pyramid WSGI application.

Typically there is no need to call this function directly, but it may be configured as the web app entry point like so:

[app:main]
use = egg:wuttaweb

The app returned by this function is quite minimal, so most apps will need to define their own main() function, and use that instead.

wuttaweb.app.make_pyramid_config(settings)[source]

Make and return a Pyramid config object from the given settings.

The config is initialized with certain features deemed useful for all apps.

Returns:

Instance of pyramid.config.Configurator.

wuttaweb.app.make_wutta_config(settings, config_maker=None, **kwargs)[source]

Make a WuttaConfig object from the given settings.

Note that settings dict will (typically) correspond to the [app:main] section of your config file.

Regardless, the settings must contain a special key/value which is needed to identify the location of the config file. Assuming the typical scenario then, your config file should have an entry like this:

[app:main]
wutta.config = %(__file__)s

The %(__file__)s is auto-replaced with the config file path, so ultimately settings would contain something like (at minimum):

{'wutta.config': '/path/to/config/file'}

If this config file path cannot be discovered, an error is raised.