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
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
limbra
limbra
Commits
db4817d1
Commit
db4817d1
authored
Jun 28, 2017
by
LE GAC Renaud
Browse files
Update CheckAndFix to add the method is_oai.
parent
f530752c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
modules/harvest_tools/automaton.py
modules/harvest_tools/automaton.py
+1
-1
modules/harvest_tools/checkandfix.py
modules/harvest_tools/checkandfix.py
+19
-0
tests/basis/test_08_CheckAndFix_base.py
tests/basis/test_08_CheckAndFix_base.py
+4
-0
No files found.
modules/harvest_tools/automaton.py
View file @
db4817d1
...
...
@@ -393,7 +393,7 @@ class Automaton(object):
print
(
"check record"
)
try
:
self
.
check
.
recover
_oai
(
record
,
self
.
harvester
.
host
)
self
.
check
.
is
_oai
(
record
)
if
self
.
check
.
is_bad_oai_used
(
record
):
self
.
logs
[
-
1
].
idle
(
MSG_IN_DB
,
record
.
submitted
())
...
...
modules/harvest_tools/checkandfix.py
View file @
db4817d1
...
...
@@ -53,6 +53,7 @@ MSG_NO_AUTHOR = "Reject no author(s)"
MSG_NO_CONF_DATE
=
"Reject no conference date"
MSG_NO_DATE
=
"Reject no submission date"
MSG_NO_MY_AUTHOR
=
"Reject no authors of my institute"
MSG_NO_OAI
=
"Reject no OAI identifier"
MSG_NO_REF
=
"Reject incomplete paper reference. Check "
MSG_NO_YEAR
=
"Reject no publication year"
...
...
@@ -477,6 +478,24 @@ class CheckAndFix(object):
return
False
@
staticmethod
def
is_oai
(
record
):
"""Raise exception when the OAI is not defined.
Args:
record (RecordPubli): record describing a publication.
Raise:
ToolException:
OAI is not defined
"""
# field / subfield depends on the store
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
)
@
staticmethod
def
format_authors
(
record
,
fmt
=
"Last, First"
):
"""Format the author names.
...
...
tests/basis/test_08_CheckAndFix_base.py
View file @
db4817d1
...
...
@@ -34,6 +34,10 @@ def test_constructor(svc):
"^Centre de Physique des Particules de Marseille \(CPPM\)"
def
test_is_oai
(
svc
,
reccds
):
assert
svc
.
is_oai
(
reccds
)
is
None
def
test_is_bad_oai
(
svc
,
reccds
):
assert
not
svc
.
is_bad_oai_used
(
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