Commit 1d5db947 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update the logic to check conference_dates.

parent adb42593
......@@ -216,7 +216,7 @@ def edit_insert():
try:
check.country(record)
check.conference_date(record)
check.conference_date(record, selector.host)
except CheckException:
pass
......
......@@ -395,11 +395,13 @@ class CheckAndFix(object):
except ToolException as e:
raise CheckException(*e.args)
def conference_date(self, record):
def conference_date(self, record, host):
"""Check conference date.
Args:
record (RecordConf): record describing a talk or a proceeding.
host (str): possible values ares ``cds.cern.ch``
or ``inspirehep.net``
Raises:
CheckException: when dates are not found or not well formed.
......@@ -409,11 +411,20 @@ class CheckAndFix(object):
if not isinstance(record, RecordConf):
return
# check and fix conference date
# inspirehep.net
if host == "inspirehep.net":
value = record.conference_dates()
if len(value) == 0:
raise CheckException(MSG_NO_CONF_DATE)
return
# cds.cern.ch
if not (u"111" in record and "d" in record[u"111"]):
raise CheckException(MSG_NO_CONF_DATE)
raise CheckException(MSG_NO_CONF_DATE)
value = record[u"111"]["d"]
m = REG_CONF_DATES.match(value)
if not m:
......
......@@ -35,7 +35,7 @@ class Proceedings(Automaton):
try:
self.check.is_conference(record)
self.check.country(record)
self.check.conference_date(record)
self.check.conference_date(record, self.harvester.host)
self.check.clean_erratum(record)
self.check.submitted(record)
......
......@@ -35,7 +35,7 @@ class Talks(Automaton):
try:
self.check.is_conference(record)
self.check.country(record)
self.check.conference_date(record)
self.check.conference_date(record, self.harvester.host)
self.check.submitted(record)
self.check.year(record)
......
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