Skip to content

Commit

Permalink
global: fix for invenio.config import
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Witowski <witowski.sebastian@gmail.com>
  • Loading branch information
switowski committed Oct 7, 2015
1 parent 61cf419 commit d434c35
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions invenio_access/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from intbitset import intbitset

from invenio.config import CFG_SITE_ADMIN_EMAIL, CFG_SITE_LANG, CFG_SITE_RECORD
from invenio_base.globals import cfg
from invenio_ext import principal
from invenio_ext.sqlalchemy import db
from invenio.legacy.dbquery import run_sql, truncate_table
Expand Down Expand Up @@ -1307,7 +1307,7 @@ def acc_get_user_roles(id_user):
return [id_role[0] for id_role in explicit_roles]


def acc_find_possible_activities(user_info, ln=CFG_SITE_LANG):
def acc_find_possible_activities(user_info, ln=cfg['CFG_SITE_LANG']):
"""Return dictionary with all the possible activities.
The list contains all the possible activities for which the user
Expand All @@ -1328,7 +1328,7 @@ def acc_find_possible_activities(user_info, ln=CFG_SITE_LANG):

if 'runbibedit' in your_admin_activities or \
'runbibdocfile' in your_admin_activities and \
user_info['uri'].startswith('/' + CFG_SITE_RECORD + '/'):
user_info['uri'].startswith('/' + cfg['CFG_SITE_RECORD'] + '/'):
try:
# Get record ID and try to cast it to an int
current_record_id = int(
Expand Down Expand Up @@ -1836,8 +1836,8 @@ def acc_add_default_settings(superusers=(),
if type(user) is str:
user = [user]
DEF_USERS.append(user[0])
if CFG_SITE_ADMIN_EMAIL not in DEF_USERS:
DEF_USERS.append(CFG_SITE_ADMIN_EMAIL)
if cfg['CFG_SITE_ADMIN_EMAIL'] not in DEF_USERS:
DEF_USERS.append(cfg['CFG_SITE_ADMIN_EMAIL')

# add data

Expand Down
30 changes: 15 additions & 15 deletions invenio_access/local_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

# pylint: disable=C0301

from invenio.config import CFG_SITE_NAME, CFG_SITE_URL, CFG_SITE_SECURE_URL, CFG_SITE_SUPPORT_EMAIL, CFG_SITE_RECORD, CFG_SITE_ADMIN_EMAIL
from invenio_base.globals import cfg
from invenio_base.i18n import _
from invenio_base.globals import cfg as config

Expand Down Expand Up @@ -219,24 +219,24 @@

# Activities (i.e. actions) for which exists an administrative web interface.
CFG_ACC_ACTIVITIES_URLS = {
'runbibedit' : (_("Run Record Editor"), "%s/%s/edit/?ln=%%s" % (CFG_SITE_URL, CFG_SITE_RECORD)),
'runbibdocfile' : (_("Run Document File Manager"), "%s/%s/managedocfiles?ln=%%s" % (CFG_SITE_URL, CFG_SITE_RECORD)),
'runbibmerge' : (_("Run Record Merger"), "%s/%s/merge/?ln=%%s" % (CFG_SITE_URL, CFG_SITE_RECORD)),
'cfgbibknowledge' : (_("Configure BibKnowledge"), "%s/kb?ln=%%s" % CFG_SITE_URL),
'cfgoaiharvest' : (_("Configure OAI Harvest"), "%s/admin/oaiharvest/oaiharvestadmin.py?ln=%%s" % CFG_SITE_URL),
'cfgwebaccess' : (_("Configure WebAccess"), "%s/admin/webaccess/webaccessadmin.py?ln=%%s" % CFG_SITE_URL),
'cfgwebcomment' : (_("Configure WebComment"), "%s/admin/webcomment/webcommentadmin.py?ln=%%s" % CFG_SITE_URL),
'claimpaper_claim_others_papers' : (_("Run Person/Author Manager"), "%s/author/search?ln=%%s" % CFG_SITE_URL)
'runbibedit' : (_("Run Record Editor"), "%s/%s/edit/?ln=%%s" % (cfg['CFG_SITE_URL'], cfg['CFG_SITE_RECORD'])),
'runbibdocfile' : (_("Run Document File Manager"), "%s/%s/managedocfiles?ln=%%s" % (cfg['CFG_SITE_URL'], cfg['CFG_SITE_RECORD'])),
'runbibmerge' : (_("Run Record Merger"), "%s/%s/merge/?ln=%%s" % (cfg['CFG_SITE_URL'], cfg['CFG_SITE_RECORD'])),
'cfgbibknowledge' : (_("Configure BibKnowledge"), "%s/kb?ln=%%s" % cfg['CFG_SITE_URL']),
'cfgoaiharvest' : (_("Configure OAI Harvest"), "%s/admin/oaiharvest/oaiharvestadmin.py?ln=%%s" % cfg['CFG_SITE_URL']),
'cfgwebaccess' : (_("Configure WebAccess"), "%s/admin/webaccess/webaccessadmin.py?ln=%%s" % cfg['CFG_SITE_URL']),
'cfgwebcomment' : (_("Configure WebComment"), "%s/admin/webcomment/webcommentadmin.py?ln=%%s" % cfg['CFG_SITE_URL']),
'claimpaper_claim_others_papers' : (_("Run Person/Author Manager"), "%s/author/search?ln=%%s" % cfg['CFG_SITE_URL'])
}

CFG_WEBACCESS_MSGS = {
0: 'Try to <a href="%s/youraccount/login?referer=%%s">login</a> with another account.' % (CFG_SITE_SECURE_URL),
1: '<br />If you think this is not correct, please contact: <a href="mailto:%s">%s</a>' % (CFG_SITE_SUPPORT_EMAIL, CFG_SITE_SUPPORT_EMAIL),
2: '<br />If you have any questions, please write to <a href="mailto:%s">%s</a>' % (CFG_SITE_SUPPORT_EMAIL, CFG_SITE_SUPPORT_EMAIL),
3: 'Guest users are not allowed, please <a href="%s/youraccount/login">login</a>.' % CFG_SITE_SECURE_URL,
0: 'Try to <a href="%s/youraccount/login?referer=%%s">login</a> with another account.' % (cfg['CFG_SITE_SECURE_URL']),
1: '<br />If you think this is not correct, please contact: <a href="mailto:%s">%s</a>' % (cfg['CFG_SITE_SUPPORT_EMAIL'], cfg['CFG_SITE_SUPPORT_EMAIL']),
2: '<br />If you have any questions, please write to <a href="mailto:%s">%s</a>' % (cfg['CFG_SITE_SUPPORT_EMAIL'], cfg['CFG_SITE_SUPPORT_EMAIL']),
3: 'Guest users are not allowed, please <a href="%s/youraccount/login">login</a>.' % cfg['CFG_SITE_SECURE_URL'],
4: 'The site is temporarily closed for maintenance. Please come back soon.',
5: 'Authorization failure',
6: '%s temporarily closed' % CFG_SITE_NAME,
6: '%s temporarily closed' % cfg['CFG_SITE_NAME'],
7: 'This functionality is temporarily closed due to server maintenance. Please use only the search engine in the meantime.',
8: 'Functionality temporarily closed',
9: '<br />If you think this is not correct, please contact: <a href="mailto:%s">%s</a>',
Expand Down Expand Up @@ -267,6 +267,6 @@
20: """No roles are authorized to perform action %s with the given parameters.""",
21: """Verification cancelled""",
22: """Verification failed. Please try again or use another provider to login""",
23: """Verification failed. It is probably because the configuration isn't set properly. Please contact with the <a href="mailto:%s">administator</a>""" % CFG_SITE_ADMIN_EMAIL
23: """Verification failed. It is probably because the configuration isn't set properly. Please contact with the <a href="mailto:%s">administator</a>""" % cfg['CFG_SITE_ADMIN_EMAIL']
}

0 comments on commit d434c35

Please sign in to comment.