Commit c146064d authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Use current.db instead of current.globalenv['db'].

parent 21d46fae
......@@ -26,7 +26,7 @@ def INHIBIT_CASCADE_DELETE(set_records):
bool: ``True`` when the delete is inhibited
"""
db, T = current.globalenv["db"], current.T
db, T = current.db, current.T
field = set_records.query.first
# protection
......@@ -73,7 +73,7 @@ def INHIBIT_CONTROLLER_INSERT(values):
bool: ``True`` when the insert is inhibited
"""
db, T = current.globalenv["db"], current.T
db, T = current.db, current.T
# check the pair
if "id" in values:
......@@ -130,7 +130,7 @@ def INHIBIT_DUPLICATE_PUBLICATION(publication):
bool: ``True`` when the insert is inhibited
"""
db, T = current.globalenv["db"], current.T
db, T = current.db, current.T
categories = db.categories
id_category = publication["id_categories"]
......@@ -204,7 +204,7 @@ def INHIBIT_HARVESTER(harvester):
bool: ``True`` when the insert is inhibited
"""
db, T = current.globalenv["db"], current.T
db, T = current.db, current.T
# a new harvester
id_harvester = get_id(db.harvesters,
......@@ -259,7 +259,7 @@ def INHIBIT_PUBLICATION_DELETE_ON_OK(s):
bool: ``True`` when the delete is inhibited.
"""
db, T = current.globalenv["db"], current.T
db, T = current.db, current.T
id_ok = get_id(db.status, code="OK")
# also call in cascade delete (teams, ...)
......@@ -289,7 +289,7 @@ def INHIBIT_PUBLICATION_UPDATE_ON_OK(s, f):
bool: ``True`` when the update is inhibited.
"""
db, T = current.globalenv["db"], current.T
db, T = current.db, current.T
id_ok = get_id(db.status, code="OK")
# protection
......
......@@ -234,7 +234,7 @@ def duplicate_article(publication):
"""
ids = []
db = current.globalenv["db"]
db = current.db
categories = db.categories
publications = db.publications
......@@ -289,7 +289,7 @@ def duplicate_conference(publication, proceeding=False):
"""
ids = []
db = current.globalenv["db"]
db = current.db
categories = db.categories
publications = db.publications
......@@ -339,7 +339,7 @@ def duplicate_origin(publication):
"""
ids = []
db = current.globalenv["db"]
db = current.db
publications = db.publications
......@@ -374,7 +374,7 @@ def duplicate_report(publication):
"""
ids = []
db = current.globalenv["db"]
db = current.db
publications = db.publications
......
......@@ -85,7 +85,7 @@ class CheckAndFix(object):
"""
def __init__(self):
self.db = current.globalenv['db']
self.db = current.db
self.reg_institute = self._get_reg_institute()
# private cache for my_author rescue list
......
......@@ -11,7 +11,7 @@ def test_is_record_in_db():
It is in the database and load from cds.cern.ch.
"""
db = current.globalenv['db']
db = current.db
# check that the record is in the database
query = db.publications.origin.contains("http://cds.cern.ch/record/1389907")
......
......@@ -44,7 +44,7 @@ def test_format_author(value, expected):
def test_search_synonym():
db = current.globalenv['db']
db = current.db
# collaboration ANTARES, TANAMI (should not be defined as a synonym)
record = load_record("inspirehep.net", 1342250)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment