common_settings.py 3.01 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 18 19 20 21 22 23 24 25 26
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

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

#-------------------------------------------------------------------------------
#
# 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

50 51 52 53 54 55 56 57
CONTROLLERS = ['articles',
               'notes',
               'preprints',
               'proceedings', 
               'reports',
               'talks',
               'theses']

58 59 60 61 62 63 64 65 66 67
DIRS = ['ASC', 'DESC']
AXES = ['', 'categories', 'projects', 'teams', 'time']
AXES_2 = ['categories', 'projects', 'publishers', 'teams', 'time']

ONE_HOUR = 3600000

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

68 69
STORES = ['cds.cern.ch', 'inspirehep.net']

70 71 72 73 74
#-------------------------------------------------------------------------------
#
# COMMON CONFIGURATION FOR FORMS AND GRIDS
#
#-------------------------------------------------------------------------------
75 76
tables = ['application',
          'auth_group',
77 78 79
          'auth_membership',
          'auth_user',
          'authors_roles',
80 81 82 83 84 85 86 87 88
          'axes',
          'categories',
          'collaborations',
          'controllers',
          'countries',
          'cppm_authors',
          'harvesters',
          'lists',
          'metrics',
89
          'organisation',
90 91 92 93 94 95 96 97 98
          'projects',
          'publications',
          'publishers',
          'renderers',
          'reports',
          'sections',
          'status',
          'teams']

99
dbui.configure_forms(tables, plugins=['pFormToolTip'], width=350)
100 101 102 103 104

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