vigigraph / vigigraph / websetup.py @ f424679c
History | View | Annotate | Download (933 Bytes)
1 |
# -*- coding: utf-8 -*-
|
---|---|
2 |
"""Setup the vigigraph application"""
|
3 |
|
4 |
__all__ = ['setup_app', 'populate_db'] |
5 |
|
6 |
def setup_app(command, conf, variables): |
7 |
"""Place any commands to setup vigigraph here"""
|
8 |
from vigilo.turbogears import populate_db as tg_pop_db |
9 |
from vigigraph.config.environment import load_environment |
10 |
|
11 |
load_environment(conf.global_conf, conf.local_conf) |
12 |
tg_pop_db() |
13 |
|
14 |
def populate_db(bind): |
15 |
from vigilo.models.session import DBSession |
16 |
from vigilo.models import tables |
17 |
|
18 |
permissions = { |
19 |
'vigigraph-access':
|
20 |
'Gives access to VigiGraph',
|
21 |
} |
22 |
|
23 |
for (permission_name, description) in permissions.iteritems(): |
24 |
if not tables.Permission.by_permission_name(unicode(permission_name)): |
25 |
DBSession.add(tables.Permission( |
26 |
permission_name=unicode(permission_name),
|
27 |
description=unicode(description),
|
28 |
)) |
29 |
DBSession.flush() |