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

Reject record with undefined oai as soon as posible.

parent 8f37ee99
......@@ -5,17 +5,27 @@
import re
import traceback
from base import format_author_fr, MSG_FIX_ORIGIN, MSG_IN_DB, ToolException
from import Storage
from invenio_tools import CheckAndFix, InvenioStore, Marc12, OAI_URL, REG_YEAR
from invenio_tools import (CheckAndFix,
from msg import Msg
from msgcollection import MsgCollection
from plugin_dbui import get_create_id, get_id, UNDEF_ID
MSG_NO_CAT = 'Select a "category" !!!'
MSG_NO_PROJECT = 'Select a "project" !!!'
MSG_NO_TEAM = 'Select a "team" !!!'
MSG_NO_OAI = "Reject no OAI identifier"
MSG_WELL_FORMED_OAI = "Reject OAI is not well formed"
class PublicationsTool(object):
"""Base class to search and process publications.
......@@ -521,6 +531,16 @@ class PublicationsTool(object):,
# reject record with undefined OAI field
oai = record.oai()
if not oai:
self.logs[-1].reject(MSG_NO_OAI, record.year())
# reject record is not well form OAI
match = REG_OAI.match(oai)
if not match:
self.logs[-1].reject(MSG_WELL_FORM_OAI, record.year())
# additional selection stage
# at this step the validity of the record is checked
# and non-conformities are repaired
......@@ -49,7 +49,6 @@ MSG_NO_AUTHOR = "Reject no author(s)"
MSG_NO_COUNTRY = "Reject invalid country"
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"
MSG_NO_YEAR = "Reject no publication year"
......@@ -64,7 +63,6 @@ MSG_WELL_FORMED_CONF_DATES = "Reject conference dates is not well formed"
MSG_WELL_FORMED_DATE = "Reject submission date is not well formed"
MSG_WELL_FORMED_EDITOR = "Reject editor is not well formed"
MSG_WELL_FORMED_OAI = "Reject OAI is not well formed"
OAI_INVENIO = "oai:%s:%s"
......@@ -525,15 +523,9 @@ class CheckAndFix(object):
@raise CheckException:
# check that the OAI is defined
value = record.oai()
if not value:
raise CheckException(MSG_NO_OAI)
# check that the OAI is well formed
match = REG_OAI.match(value)
if not match:
raise CheckException(MSG_WELL_FORMED_OAI)
myid =
# The id in the OAI field might be different from the record id.
# In INVENIO there is a mechanism to redirect to the correct one
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