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

4 5
    setup the connection to the databases.
    Define constants for the different role
6 7
    
"""
8
DB_MYSQL = 'mysql://GesProd:Prod_CPPM@maretude.in2p3.fr/GesProd'
9 10
MIGRATE = False

11 12
ID_ADMIN, ADMIN, DEF_ADMIN = 1, 'admin', 'administrators, librairians,...'
ID_USER, USER, DEF_USER = 2, 'user', 'liaisons, team leaders,...'
13

14
#-------------------------------------------------------------------------------
15
#
16
# MYSQL database
17
#
18
#-------------------------------------------------------------------------------
LE GAC Renaud's avatar
LE GAC Renaud committed
19
try:
LE GAC Renaud's avatar
LE GAC Renaud committed
20
    db = DAL(DB_MYSQL, lazy_tables=False, migrate_enabled=MIGRATE, pool_size=10)
LE GAC Renaud's avatar
LE GAC Renaud committed
21 22
except:
    raise HTTP(500, T("Can't access the MySQL database !!!"))
23

24 25 26 27 28
#-------------------------------------------------------------------------------
#
# SQLITE database (test)
#
#-------------------------------------------------------------------------------
LE GAC Renaud's avatar
LE GAC Renaud committed
29
# db = DAL('sqlite://storage.sqlite', lazy_tables=False, migrate_enabled=MIGRATE)
30 31 32 33 34 35 36

#-------------------------------------------------------------------------------
#
# virtual database
#
#-------------------------------------------------------------------------------
virtdb = DAL(None)