access.py 1.16 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
# Production at CPPM
LE GAC Renaud's avatar
LE GAC Renaud committed
9 10 11
DB_HOST = 'maretude.in2p3.fr'
DB_USER = 'GesProd'
DB_PWD = 'Prod_CPPM'
12 13 14 15 16 17 18 19
DATABASE = 'GesProd' 

# Test database
# DB_HOST = 'localhost'
# DB_USER = 'GesProd'
# DB_PWD = 'Prod_CPPM'
# DATABASE = 'test_publications'

LE GAC Renaud's avatar
LE GAC Renaud committed
20
# Migration flags
21
MIGRATE = False
LE GAC Renaud's avatar
LE GAC Renaud committed
22
MIGRATE_USER = False
23

24
# Roles
25 26
ID_ADMIN, ADMIN, DEF_ADMIN = 1, 'admin', 'administrators, librairians,...'
ID_USER, USER, DEF_USER = 2, 'user', 'liaisons, team leaders,...'
27

28
#-------------------------------------------------------------------------------
29
#
30
# MYSQL database
31
#
32
#-------------------------------------------------------------------------------
LE GAC Renaud's avatar
LE GAC Renaud committed
33
try:
34 35
    mysql = 'mysql://%s:%s@%s/%s' % (DB_USER, DB_PWD, DB_HOST, DATABASE)
    db = DAL(mysql, lazy_tables=False, migrate_enabled=MIGRATE, pool_size=10)
LE GAC Renaud's avatar
LE GAC Renaud committed
36 37
except:
    raise HTTP(500, T("Can't access the MySQL database !!!"))
38

39 40 41 42 43 44
#-------------------------------------------------------------------------------
#
# virtual database
#
#-------------------------------------------------------------------------------
virtdb = DAL(None)