Commit 9d0b9cb2 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

CheckAndFix methods collaboration, country and publisher return CheckException...

CheckAndFix methods collaboration, country and publisher return CheckException instead of ToolException.
parent 242e3118
......@@ -5,7 +5,7 @@
import re
import regex
from base import search_synonym
from base import search_synonym, ToolException
from exception import CheckException
from invenio_tools import (load_record,
MSG_NO_CONF,
......@@ -355,7 +355,7 @@ class CheckAndFix(object):
record (RecordPubli): record describing a publication.
Raises:
ToolException: when the collaboration value is defined
CheckException: when the collaboration value is defined
nor entered as a synonym.
"""
......@@ -364,7 +364,12 @@ class CheckAndFix(object):
return
db = self.db
search_synonym(db.collaborations, "collaboration", val)
try:
search_synonym(db.collaborations, "collaboration", val)
except ToolException as e:
raise CheckException(*e.args)
def country(self, record):
"""Check conference country.
......@@ -374,7 +379,7 @@ class CheckAndFix(object):
record (RecordConf): record describing a talk or a proceeding.
Raises:
ToolException: when the country is not defined
CheckException: when the country is not defined
nor entered as a synonym.
"""
......@@ -383,7 +388,11 @@ class CheckAndFix(object):
db = self.db
val = record.conference_country()
search_synonym(db.countries, "country", val)
try:
search_synonym(db.countries, "country", val)
except ToolException as e:
raise CheckException(*e.args)
def conference_date(self, record):
"""Check conference date.
......@@ -758,7 +767,7 @@ class CheckAndFix(object):
record (RecordPubli): record describing a publication.
Raises:
ToolException: when the publisher is not defined
CheckException: when the publisher is not defined
nor entered as a synonym.
"""
......@@ -771,7 +780,11 @@ class CheckAndFix(object):
if isinstance(val, list):
val = val[0]
search_synonym(db.publishers, "abbreviation", val)
# convert ToolException to CheckExcpetion
try:
search_synonym(db.publishers, "abbreviation", val)
except ToolException as e:
raise CheckException(*e.args)
def recover_oai(self, record, host):
"""Recover the OAI identifier when it is not defined
......
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