Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
c146064d
Commit
c146064d
authored
May 11, 2017
by
LE GAC Renaud
Browse files
Use current.db instead of current.globalenv['db'].
parent
21d46fae
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
13 deletions
+13
-13
modules/callbacks.py
modules/callbacks.py
+6
-6
modules/check_tools.py
modules/check_tools.py
+4
-4
modules/harvest_tools/checkandfix.py
modules/harvest_tools/checkandfix.py
+1
-1
tests/harvest_tools/Automaton/test_reject_on_oai.py
tests/harvest_tools/Automaton/test_reject_on_oai.py
+1
-1
tests/harvest_tools/test_harvest_tools_functions.py
tests/harvest_tools/test_harvest_tools_functions.py
+1
-1
No files found.
modules/callbacks.py
View file @
c146064d
...
...
@@ -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
...
...
modules/check_tools.py
View file @
c146064d
...
...
@@ -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
...
...
modules/harvest_tools/checkandfix.py
View file @
c146064d
...
...
@@ -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
...
...
tests/harvest_tools/Automaton/test_reject_on_oai.py
View file @
c146064d
...
...
@@ -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"
)
...
...
tests/harvest_tools/test_harvest_tools_functions.py
View file @
c146064d
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment