vigigraph / vigigraph / websetup.py @ 37c372c5
History | View | Annotate | Download (1.06 KB)
1 |
# -*- coding: utf-8 -*-
|
---|---|
2 |
# Copyright (C) 2011-2013 CS-SI
|
3 |
# License: GNU GPL v2 <http://www.gnu.org/licenses/gpl-2.0.html>
|
4 |
|
5 |
"""Setup the vigigraph application"""
|
6 |
|
7 |
# pylint: disable-msg=W0613
|
8 |
# W0613: Unused argument
|
9 |
|
10 |
__all__ = ['setup_app', 'populate_db'] |
11 |
|
12 |
def setup_app(command, conf, variables): |
13 |
"""Place any commands to setup vigigraph here"""
|
14 |
from vigilo.turbogears import populate_db as tg_pop_db |
15 |
from vigigraph.config.environment import load_environment |
16 |
|
17 |
load_environment(conf.global_conf, conf.local_conf) |
18 |
tg_pop_db() |
19 |
|
20 |
def populate_db(bind): |
21 |
from vigilo.models.session import DBSession |
22 |
from vigilo.models import tables |
23 |
|
24 |
permissions = { |
25 |
'vigigraph-access':
|
26 |
'Gives access to VigiGraph',
|
27 |
} |
28 |
|
29 |
for (permission_name, description) in permissions.iteritems(): |
30 |
if not tables.Permission.by_permission_name(unicode(permission_name)): |
31 |
DBSession.add(tables.Permission( |
32 |
permission_name=unicode(permission_name),
|
33 |
description=unicode(description),
|
34 |
)) |
35 |
DBSession.flush() |