common_settings.py 3.42 KB
Newer Older
1 2 3 4 5
# -*- coding: utf-8 -*-
""" Common settings

"""
import filters
6
import harvest_tools
7 8 9 10 11 12 13 14 15 16 17
import locale
import plugin_dbui as dbui

from callbacks import (INHIBIT_CASCADE_DELETE,
                       INHIBIT_DUPLICATE_PUBLICATION,
                       INHIBIT_PUBLICATION_DELETE_ON_OK,
                       INHIBIT_PUBLICATION_UPDATE_ON_OK)

from datetime import datetime
from gluon.tools import PluginManager

18 19 20 21
from regex import (REG_COLLABORATION, 
                   REG_CONF_DATES, 
                   REG_DEFENSE, 
                   REG_SUBMITTED)
22

23 24 25 26 27 28 29 30 31
#-------------------------------------------------------------------------------
#
# PLUGIN DBUI
#
#-------------------------------------------------------------------------------
plugins = PluginManager()
plugins.dbui.app_css = 'static/my.css'
#plugins.dbui.app_js_dir = None
#plugins.dbui.app_libmin = None
32 33
plugins.dbui.app_script = 'static/app.js'
#plugins.dbui.app_script_dir = None
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

#-------------------------------------------------------------------------------
#
# LANGUAGE
#
#-------------------------------------------------------------------------------
T.set_current_languages('en', 'en-gb', 'en-us')     # mother tongue
T.force('fr-fr')                                    # user language
T.lazy = False                                      # immediate translation

locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")

#-------------------------------------------------------------------------------
#
# CONSTANTS
#
#-------------------------------------------------------------------------------
undef = T(dbui.UNDEF)
undef_id = dbui.UNDEF_ID
year = datetime.now().year

55 56 57 58 59 60 61 62
CONTROLLERS = ['articles',
               'notes',
               'preprints',
               'proceedings', 
               'reports',
               'talks',
               'theses']

63 64
DIRS = ['ASC', 'DESC']

65 66 67 68 69 70 71 72 73 74
CAT_USUAL = [T('article'), 
             T('book'), 
             T('patent'),
             T('poster'), 
             T('proceeding'), 
             T('report'), 
             T('talk'), 
             T('thesis'),
             undef]
CAT_USUAL.sort()
75 76 77 78 79

MODE_DRY_RUN = T(harvest_tools.DRY_RUN)
MODE_CHANGE_STATUS = T('change status')
MODE_LOAD_IN_DB = T('load in the database')

80 81
ONE_HOUR = 3600000

82 83
STORES = ['cds.cern.ch', 'inspirehep.net']

84 85 86 87 88
#-------------------------------------------------------------------------------
#
# COMMON CONFIGURATION FOR FORMS AND GRIDS
#
#-------------------------------------------------------------------------------
89 90
tables = ['application',
          'auth_group',
91 92 93
          'auth_membership',
          'auth_user',
          'authors_roles',
94 95 96 97 98 99
          'axes',
          'categories',
          'collaborations',
          'controllers',
          'countries',
          'harvesters',
100
          'graphs',
101 102
          'lists',
          'metrics',
LE GAC Renaud's avatar
LE GAC Renaud committed
103
          'my_authors',
104
          'organisation',
105 106 107 108 109 110 111 112 113
          'projects',
          'publications',
          'publishers',
          'renderers',
          'reports',
          'sections',
          'status',
          'teams']

114 115 116 117
# a user see the categories table but he/she can not modify it.
if session.role == USER:
    tables.remove('categories')
    
118
dbui.configure_forms(tables, plugins=['pFormToolTip'], width=350)
119 120 121 122 123

dbui.configure_grids(tables, plugins=['pGridRowEditorConfirmDelete',
                                      'pGridRowEditorContextMenu',
                                      'pGridRowEditorDblClick',
                                      'pGridToolbar'])