Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 6409d1e6 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Bug fix when rejecting record with invalid OAI.

parent b09c6dd3
......@@ -450,7 +450,7 @@ class Automaton(object):
# the search is perform on a range of creation date
# if not defined all element are return
#
# The method use here minimise the memory usage
# The method use here minimize the memory usage
# on the server as well as on the client side
for collection in collections:
......@@ -511,8 +511,9 @@ class Automaton(object):
if self.dbg:
print "process xml record"
# NOTE: BaseException and inherited class
# are catched by the previous stage
# NOTE
# BaseException and inherited class
# are caught by the previous stage
records = self.marc12(xml)
# process individual record
......@@ -529,13 +530,15 @@ class Automaton(object):
# reject record with undefined OAI field
oai = record.oai()
if not oai:
if oai is None:
self.logs[-1].reject(MSG_NO_OAI, record.year())
continue
# reject record is not well form OAI
# reject the record when the OAI is not well
match = REG_OAI.match(oai)
if not match:
self.logs[-1].reject(MSG_WELL_FORM_OAI, record.year())
continue
# check that the record is well formed
# repair non-conformity as far as possible
......
......@@ -409,26 +409,26 @@ class CheckAndFix(object):
raise CheckException(MSG_WELL_FORMED_CONF_DATES)
def is_bad_oai_used(self, record):
"""The id in the OAI field might be different from the record id.
It happens when an old record is redirected to new one for obscure
reasons.
Return C{TRue} if the "bad OAI" is found in the database.
"""The id in the OAI field is different from the record id.
This happens when an old record is redirected to new one
for obscure reasons. The method return C{True} when a record
with the bad OAI is found in the database.
@type record: L{Record}
@param record:
@rtype: bool
@return: C{True} when a record is found in the database with
the bad OAI.
"""
value = record.oai()
match = REG_OAI.match(value)
myid = record.id()
if match.group(2) != myid:
if match.group(2) != record.id():
db = self.db
# The bad OAI is already used in the database
# a record with the bad OAI exists in the database
bad_oai_url = OAI_URL % (match.group(1), match.group(2))
if get_id(db.publications, origin=bad_oai_url):
return True
......
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