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

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

Replace CheckAndFix.fix_oai by CheckAndFix.is_bad_oai_used.

parent 65cee30d
......@@ -64,7 +64,6 @@ class Articles(Automaton):
self.check.format_authors(record, format_author_fr)
self.check.get_my_authors(record, family_name_fr)
self.check.fix_oai(record)
except CheckException as e:
self.logs[-1].reject(e, record.year())
......
......@@ -280,6 +280,10 @@ class Automaton(object):
print "check record"
try:
if self.check.is_bad_oai_used(record):
self.logs[-1].idle(MSG_IN_DB, record.year())
return False
self.check.temporary_record(record)
self.check.authors(record)
self.check.my_affiliation(record, self.id_project, self.id_team)
......
......@@ -38,7 +38,6 @@ class Notes(Automaton):
self.check.format_authors(record, format_author_fr)
self.check.get_my_authors(record, family_name_fr)
self.check.fix_oai(record)
except CheckException as e:
self.logs[-1].reject(e, record.year())
......
......@@ -60,7 +60,6 @@ class Preprints(Automaton):
self.check.format_authors(record, format_author_fr)
self.check.get_my_authors(record, family_name_fr)
self.check.fix_oai(record)
except CheckException as e:
self.logs[-1].reject(e, record.year())
......
......@@ -46,7 +46,6 @@ class Proceedings(Automaton):
self.check.format_authors(record, format_author_fr)
self.check.get_my_authors(record, family_name_fr)
self.check.fix_oai(record)
except CheckException as e:
self.logs[-1].reject(e, record.year())
......
......@@ -45,7 +45,6 @@ class Reports(Automaton):
self.check.format_authors(record, format_author_fr)
self.check.get_my_authors(record, family_name_fr)
self.check.fix_oai(record)
except CheckException as e:
self.logs[-1].reject(e, record.year())
......
......@@ -42,7 +42,6 @@ class Talks(Automaton):
self.check.format_authors(record, format_author_fr)
self.check.get_my_authors(record, family_name_fr)
self.check.fix_oai(record)
except CheckException as e:
self.logs[-1].reject(e, record.year())
......
......@@ -41,7 +41,6 @@ class Thesis(Automaton):
self.check.format_authors(record, format_author_fr)
self.check.get_my_authors(record, family_name_fr)
self.check.fix_oai(record)
except CheckException as e:
self.logs[-1].reject(e, record.year())
......
......@@ -408,45 +408,32 @@ class CheckAndFix(object):
else:
raise CheckException(MSG_WELL_FORMED_CONF_DATES)
def fix_oai(self, record):
def is_bad_oai_used(self, record):
"""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
The fix depend on the content of the database
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.
@type record: L{Record}
@param record:
@rtype: bool
"""
value = record.oai()
match = REG_OAI.match(value)
myid = record.id()
# 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
#
# The fix depend on the content of the database
if match.group(2) != myid:
db = self.db
# The record OAI is already used in the database. Do nothing
oai_url = OAI_URL % (match.group(1), match.group(2))
if get_id(db.publications, origin=oai_url):
return
# The OAI based on the record id is already used in the database.
# Modify the record OAI
oai_url = OAI_URL % (match.group(1), myid)
if get_id(db.publications, origin=oai_url):
# the location of the oai information depends on the store
# cds: (248, a), inspirehep: (909C0, o)
if u"0248" in record:
field, subfield = u"0248", "a"
elif u"909CO" in record:
field, subfield = u"909CO", "o"
# The bad OAI is already used 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
record[field][subfield] = OAI_INVENIO % (match.group(1), myid)
return False
def format_authors(self, record, func):
"""Format the author names using the function func.
......
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