Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

vigiboard / vigiboard / config / app_cfg.py @ 3d0d254c

History | View | Annotate | Download (3.4 KB)

1
# -*- coding: utf-8 -*-
2
# vim: set fileencoding=utf-8 sw=4 ts=4 et :
3
"""
4
Global configuration file for TG2-specific settings in vigiboard.
5

6
This file complements development/deployment.ini.
7

8
Please note that **all the argument values are strings**. If you want to
9
convert them into boolean, for example, you should use the
10
:func:`paste.deploy.converters.asbool` function, as in::
11
    
12
    from paste.deploy.converters import asbool
13
    setting = asbool(global_conf.get('the_setting'))
14
 
15
"""
16

    
17
from tg.configuration import AppConfig
18

    
19
class MyAppConfig(AppConfig):
20
    """We overload AppConfig to prevent it from loading init_model()"""
21

    
22
    def __init__(self):
23
        AppConfig.__init__(self)
24

    
25
    def setup_sqlalchemy(self):
26
        """
27
        TG2 needs to configure the DB session before anything else, then it
28
        calls init_model(). In our case, the DB session is already configured
29
        so the function call is unnecessary. We suppress TG2's behaviour here.
30
        """
31
        pass
32

    
33
import vigiboard
34
from vigiboard import model
35
from vigiboard.lib import app_globals, helpers
36

    
37
base_config = MyAppConfig()
38
base_config.renderers = []
39

    
40
base_config.package = vigiboard
41

    
42
#Set the default renderer
43
base_config.default_renderer = 'genshi'
44
base_config.renderers.append('genshi')
45
# if you want raw speed and have installed chameleon.genshi
46
# you should try to use this renderer instead.
47
# warning: for the moment chameleon does not handle i18n translations
48
#base_config.renderers.append('chameleon_genshi')
49

    
50
#Configure the base SQLALchemy Setup
51
base_config.use_sqlalchemy = True
52
base_config.model = model
53
base_config.DBSession = model.DBSession
54

    
55
# Configure the authentication backend
56
base_config.auth_backend = 'sqlalchemy'
57
base_config.sa_auth.dbsession = model.DBSession
58
# what is the class you want to use to search for users in the database
59
base_config.sa_auth.user_class = model.User
60
# what is the class you want to use to search for groups in the database
61
base_config.sa_auth.group_class = model.UserGroup
62
# what is the class you want to use to search for permissions in the database
63
base_config.sa_auth.permission_class = model.Permission
64
# The name "groups" is already used for groups of hosts.
65
# We use "usergroups" when referering to users to avoid confusion.
66
base_config.sa_auth.translations.groups = 'usergroups'
67

    
68
# override this if you would like to provide a different who plugin for
69
# managing login and logout of your application
70
base_config.sa_auth.form_plugin = None
71

    
72
# You may optionally define a page where you want users to be redirected to
73
# on login:
74
base_config.sa_auth.post_login_url = '/post_login'
75

    
76
# You may optionally define a page where you want users to be redirected to
77
# on logout:
78
base_config.sa_auth.post_logout_url = '/post_logout'
79

    
80

    
81
##################################
82
# Settings specific to Vigiboard #
83
##################################
84

    
85
# Vigiboard version
86
base_config['vigiboard_version'] = u'0.1'
87

    
88
# Links configuration
89
# XXX Should be part of ini settings.
90
base_config['vigiboard_links.eventdetails'] = {
91
    'nagios': ['Nagios host details', 'http://example1.com/%(idaggregate)d'],
92
    'metrology': ['Metrology details', 'http://example2.com/%(idaggregate)d'],
93
    'security': ['Security details', 'http://example3.com/%(idaggregate)d'],
94
    'servicetype': ['Service Type', 'http://example4.com/%(idaggregate)d'],
95
}
96

    
97
# Plugins to use
98
# XXX Should be part of ini settings.
99
base_config['vigiboard_plugins'] = [
100
    ['shn', 'PluginSHN'],
101
]
102