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
336fb685
Commit
336fb685
authored
Jul 03, 2017
by
LE GAC Renaud
Browse files
Re-implement the procedure to fix missing OAI.
parent
79a58da4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
modules/harvest_tools/automaton.py
modules/harvest_tools/automaton.py
+6
-1
modules/harvest_tools/checkandfix.py
modules/harvest_tools/checkandfix.py
+5
-6
tests/basis/test_08_CheckAndFix_base.py
tests/basis/test_08_CheckAndFix_base.py
+1
-1
No files found.
modules/harvest_tools/automaton.py
View file @
336fb685
...
...
@@ -25,6 +25,8 @@ MSG_NO_TEAM = 'Select a "team" !!!'
MSG_INSERT_FAIL
=
"Fail to insert the new record in the database."
OAI
=
u
"oai:%s:%i"
# search collection when using inspirehep
# require for "Hal Hidden"
REG_COLLECTION
=
re
.
compile
(
r
"cc([A-Za-z ]+)(and|$)"
)
...
...
@@ -389,7 +391,10 @@ class Automaton(object):
print
(
"check record"
)
try
:
self
.
check
.
is_oai
(
record
)
# fix record with a missing OAI
if
not
self
.
check
.
is_oai
(
record
):
oai
=
OAI
%
(
self
.
harvester
.
host
,
record
.
id
)
record
[
u
"oai"
]
=
{
u
"value"
:
oai
}
if
self
.
check
.
is_bad_oai_used
(
record
):
self
.
logs
[
-
1
].
idle
(
MSG_IN_DB
,
record
.
submitted
())
...
...
modules/harvest_tools/checkandfix.py
View file @
336fb685
...
...
@@ -529,14 +529,14 @@ class CheckAndFix(object):
return
False
def
is_oai
(
self
,
record
):
"""
Raise exception
when the OAI is not defined.
"""
``True``
when the OAI is not defined
in the record
.
Args:
record (RecordPubli): record describing a publication.
R
aise
:
T
ool
Exception
:
OAI is not defined
R
eturns
:
b
ool:
``True`` when the
OAI is not defined
in the record.
"""
if
self
.
dbg
:
print
"
\t\t
Check is oai"
...
...
@@ -545,8 +545,7 @@ class CheckAndFix(object):
test
=
(
u
"oai"
in
record
and
u
"value"
in
record
[
u
"oai"
])
or
\
(
u
"FIXME_OAI"
in
record
and
u
"id"
in
record
[
u
"FIXME_OAI"
])
if
not
test
:
raise
ToolException
(
MSG_NO_OAI
)
return
test
def
format_authors
(
self
,
record
,
fmt
=
"Last, First"
):
"""Format the author names.
...
...
tests/basis/test_08_CheckAndFix_base.py
View file @
336fb685
...
...
@@ -35,7 +35,7 @@ def test_constructor(svc):
def
test_is_oai
(
svc
,
reccds
):
assert
svc
.
is_oai
(
reccds
)
is
None
assert
svc
.
is_oai
(
reccds
)
def
test_is_bad_oai
(
svc
,
reccds
):
...
...
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