Commit 1364f2d9 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update to deal with search_synonym exception

parent 199d216f
......@@ -6,7 +6,7 @@ from .base import (MSG_NO_CONF_DATE,
REG_DATE,
search_synonym,
T6)
from .exception import CheckException
from .exception import CheckException, ToolException
from datetime import datetime
from plugin_dbui import CLEAN_SPACES, UNDEF_ID
......@@ -70,13 +70,17 @@ class ConfMixin(object):
if len(val) == 0:
raise CheckException(MSG_UNKNOWN_COUNTRY)
dbid = search_synonym(db.countries, "country", val)
if dbid == UNDEF_ID:
raise CheckException(MSG_UNKNOWN_COUNTRY)
try:
dbid = search_synonym(db.countries, "country", val)
if dbid == UNDEF_ID:
raise CheckException(MSG_UNKNOWN_COUNTRY)
country = db.countries[dbid].country
if country != val:
self.conference["addresses"][0]["country"] = country
country = db.countries[dbid].country
if country != val:
self.conference["addresses"][0]["country"] = country
except ToolException as e:
raise CheckException(*e.args)
def conference_country(self):
"""The country where the conference took place.
......
......@@ -16,7 +16,7 @@ from .base import (ARXIV,
REG_DOI,
REG_OAI,
T4, T6)
from .exception import CheckException
from .exception import CheckException, ToolException
from filters import CLEAN_COLLABORATION
from pandas import concat, DataFrame
from plugin_dbui import CLEAN_SPACES, UNDEF_ID
......@@ -400,9 +400,13 @@ class RecordCdsPubli(dict, AuthorsMixin, PublicationInfoMixin):
if len(val) == 0:
return
dbid = search_synonym(db.collaborations, "collaboration", val)
if dbid == UNDEF_ID:
raise CheckException(MSG_UNKNOWN_COLLABORATION)
try:
dbid = search_synonym(db.collaborations, "collaboration", val)
if dbid == UNDEF_ID:
raise CheckException(MSG_UNKNOWN_COLLABORATION)
except ToolException as e:
raise CheckException(*e.args)
collaboration = db.collaborations[dbid].collaboration
......
......@@ -247,7 +247,7 @@ class RecordHepPubli(dict, AuthorsMixin, PublicationInfoMixin):
self["collaborations"] = [{"value": collaboration}]
except ToolException as e:
raise CheckException(e)
raise CheckException(*e.args)
def check_my_affiliation(self, rex_institute=None):
"""Check that authors of my institute are signatories.
......
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