Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

vigiboard / vigiboard / config / middleware.py @ 0f56fff9

History | View | Annotate | Download (1.3 KB)

1
# -*- coding: utf-8 -*-
2
# vim: set fileencoding=utf-8 sw=4 ts=4 et :
3
"""WSGI middleware initialization for the vigiboard application."""
4

    
5
from vigiboard.config.app_cfg import base_config
6
from vigiboard.config.environment import load_environment
7

    
8
__all__ = ['make_app']
9

    
10
# Use base_config to setup the necessary PasteDeploy application factory. 
11
# make_base_app will wrap the TG2 app with all the middleware it needs. 
12
make_base_app = base_config.setup_tg_wsgi_app(load_environment)
13

    
14

    
15
def make_app(global_conf, full_stack=True, **app_conf):
16
    """
17
    Set vigiboard up with the settings found in the PasteDeploy configuration
18
    file used.
19
    
20
    This is the PasteDeploy factory for the vigiboard application.
21
    
22
    C{app_conf} contains all the application-specific settings (those defined
23
    under ``[app:main]``).
24
    
25
    @param global_conf: The global settings for vigiboard (those
26
        defined under the ``[DEFAULT]`` section).
27
    @type global_conf: C{dict}
28
    @param full_stack: Should the whole TG2 stack be set up?
29
    @type full_stack: C{str} or C{bool}
30
    @return: The vigiboard application with all the relevant middleware
31
        loaded.
32
    """
33
    app = make_base_app(global_conf, full_stack=True, **app_conf)
34

    
35
    # Wrap your base TurboGears 2 application with custom middleware here
36

    
37
    return app
38