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

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