access.py 743 Bytes
Newer Older
LE GAC Renaud's avatar
LE GAC Renaud committed
1 2 3
# -*- coding: utf-8 -*-
""" access

4 5
    setup the connection to the databases.
    Define constants for the different role
LE GAC Renaud's avatar
LE GAC Renaud committed
6

LE GAC Renaud's avatar
LE GAC Renaud committed
7
"""
8
# Migration flags
9
MIGRATE = False
10
MIGRATE_USER = False
LE GAC Renaud's avatar
LE GAC Renaud committed
11

12
# Roles
13 14
ID_ADMIN, ADMIN, DEF_ADMIN = 1, "admin", "administrators, team leader,..."
ID_USER, USER, DEF_USER = 2, "user", "project leader,..."
LE GAC Renaud's avatar
LE GAC Renaud committed
15

16
#.............................................................................
17 18 19
#
# MYSQL database
#
20

21
try:
LE GAC Renaud's avatar
LE GAC Renaud committed
22
    mysql = DBURIS[request.application]
23 24 25
    db = DAL(mysql, lazy_tables=False, migrate_enabled=MIGRATE, pool_size=10)
except:
    raise HTTP(500, T("Can't access the MySQL database !!!"))
26

27
#.............................................................................
28 29 30
#
# virtual database
#
31

32
virtdb = DAL(None)