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

Update CheckAndFix to add the method is_oai.

parent f530752c
......@@ -393,7 +393,7 @@ class Automaton(object):
print("check record")
if self.check.is_bad_oai_used(record):
self.logs[-1].idle(MSG_IN_DB, record.submitted())
......@@ -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
def is_oai(record):
"""Raise exception when the OAI is not defined.
record (RecordPubli): record describing a publication.
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)
def format_authors(record, fmt="Last, First"):
"""Format the author names.
......@@ -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)
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