access.py 596 Bytes
Newer Older
1 2
# -*- coding: utf-8 -*-
""" access
3

4 5
    Define constants for the different role.
    Access to the databases.
6

7
"""
8 9
from _mydb import DBURIS

LE GAC Renaud's avatar
LE GAC Renaud committed
10
# Migration flags
11
MIGRATE = False
LE GAC Renaud's avatar
LE GAC Renaud committed
12
MIGRATE_USER = False
13

14
# Roles
15 16
ID_ADMIN, ADMIN, DEF_ADMIN = 1, 'admin', 'administrators, librairians,...'
ID_USER, USER, DEF_USER = 2, 'user', 'liaisons, team leaders,...'
17

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

25 26
# virtual database
virtdb = DAL(None)