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

"""
LE GAC Renaud's avatar
LE GAC Renaud committed
5
import datetime
6
import filters
7
import harvest_tools
8 9 10
import plugin_dbui as dbui

from callbacks import (INHIBIT_CASCADE_DELETE,
11 12
                       INHIBIT_CONTROLLER_INSERT,
                       INHIBIT_CONTROLLER_UPDATE,
13
                       INHIBIT_DUPLICATE_PUBLICATION,
14
                       INHIBIT_HARVESTER,
15 16 17 18 19
                       INHIBIT_PUBLICATION_DELETE_ON_OK,
                       INHIBIT_PUBLICATION_UPDATE_ON_OK)

from gluon.tools import PluginManager

LE GAC Renaud's avatar
LE GAC Renaud committed
20 21 22
from regex import (REG_COLLABORATION,
                   REG_CONF_DATES,
                   REG_DEFENSE,
23 24
                   REG_SUBMITTED,
                   REG_VALID_ORIGIN)
25

26 27 28 29 30 31 32
#-------------------------------------------------------------------------------
#
# PLUGIN DBUI
#
#-------------------------------------------------------------------------------
plugins = PluginManager()
plugins.dbui.app_css = 'static/my.css'
33
plugins.dbui.app_debug = None
34
plugins.dbui.app_lg = 'static/limbra/locale/limbra-lang-fr.js'
35
plugins.dbui.app_libmin = 'static/limbra-min.js'
36
plugins.dbui.app_script = 'static/app.js'
LE GAC Renaud's avatar
LE GAC Renaud committed
37
# plugins.dbui.app_script_dir = None
38 39 40 41 42 43

#-------------------------------------------------------------------------------
#
# LANGUAGE
#
#-------------------------------------------------------------------------------
LE GAC Renaud's avatar
LE GAC Renaud committed
44 45 46
T.set_current_languages('en', 'en-gb', 'en-us')  # mother tongue
T.force('fr-fr')  # user language
T.lazy = False  # immediate translation
47 48 49 50 51 52 53 54

#-------------------------------------------------------------------------------
#
# CONSTANTS
#
#-------------------------------------------------------------------------------
undef = T(dbui.UNDEF)
undef_id = dbui.UNDEF_ID
LE GAC Renaud's avatar
LE GAC Renaud committed
55
year = datetime.datetime.now().year
56

57 58 59
CONTROLLERS = ['articles',
               'notes',
               'preprints',
LE GAC Renaud's avatar
LE GAC Renaud committed
60
               'proceedings',
61 62 63 64
               'reports',
               'talks',
               'theses']

65 66
DIRS = ['ASC', 'DESC']

LE GAC Renaud's avatar
LE GAC Renaud committed
67 68
CAT_USUAL = [T('article'),
             T('book'),
69
             T('patent'),
LE GAC Renaud's avatar
LE GAC Renaud committed
70 71 72 73
             T('poster'),
             T('proceeding'),
             T('report'),
             T('talk'),
74 75 76
             T('thesis'),
             undef]
CAT_USUAL.sort()
77 78 79 80 81

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

82 83
ONE_HOUR = 3600000

84 85
STORES = ['cds.cern.ch', 'inspirehep.net']

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

116 117 118
# a user see the categories table but he/she can not modify it.
if session.role == USER:
    tables.remove('categories')
LE GAC Renaud's avatar
LE GAC Renaud committed
119

120
dbui.configure_forms(tables, plugins=['pFormToolTip'], width=350)
121 122 123 124 125

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