Commit 02a7f39d authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Add the checks: CheckAndFix.is_conference / is_thesis (trigger by cds2053118).

parent 10b9b585
......@@ -14,7 +14,9 @@ from harvest_tools import (format_author_fr,
from invenio_tools import (CheckAndFix,
CheckException,
load_record,
OAI_URL)
OAI_URL,
RecordConf,
RecordThesis)
from plugin_dbui import (get_id,
INLINE_ALERT,
Selector,
......@@ -183,23 +185,25 @@ def edit_insert():
except CheckException:
pass
values['PublicationsConference_title'] = record.conference_title()
values['PublicationsConference_url'] = record.conference_url()
values['PublicationsConference_dates'] = record.conference_dates()
values['PublicationsConference_town'] = record.conference_town()
if isinstance(record, RecordConf):
values['PublicationsConference_title'] = record.conference_title()
values['PublicationsConference_url'] = record.conference_url()
values['PublicationsConference_dates'] = record.conference_dates()
values['PublicationsConference_town'] = record.conference_town()
recId = get_id(db.countries, country=record.conference_country())
values['PublicationsId_countries'] = \
recId if recId is not None else UNDEF_ID
recId = get_id(db.countries, country=record.conference_country())
values['PublicationsId_countries'] = \
recId if recId is not None else UNDEF_ID
values['PublicationsConference_speaker'] = record.first_author()
values['PublicationsConference_speaker'] = record.first_author()
# thesis
if selector.controller == 'theses':
values['PublicationsUniversities'] = record.these_universities()
values['PublicationsDirectors'] = record.these_directors()
values['PublicationsDefense'] = record.these_defense()
if isinstance(record, RecordThesis):
values['PublicationsUniversities'] = record.these_universities()
values['PublicationsDirectors'] = record.these_directors()
values['PublicationsDefense'] = record.these_defense()
# submitted date and year
try:
......
......@@ -130,6 +130,7 @@ class Proceedings(PublicationsTool):
cmpFct=family_name_fr)
self.check.oai(record)
self.check.is_conference(record)
self.check.conference(record)
self.check.clean_erratum(record)
......
......@@ -98,6 +98,7 @@ class Talks(PublicationsTool):
cmpFct=family_name_fr)
self.check.oai(record)
self.check.is_conference(record)
self.check.conference(record)
self.check.submitted(record)
......
......@@ -93,6 +93,7 @@ class Thesis(PublicationsTool):
cmpFct=family_name_fr)
self.check.oai(record)
self.check.is_thesis(record)
self.check.submitted(record)
self.check.year(record)
self.check.format_universities(record)
......
......@@ -7,6 +7,9 @@ import re
ARXIV = "arXiv"
ARXIV_PDF = "http://arxiv.org/pdf/"
MSG_NO_CONF = "Reject no conference information"
MSG_NO_THESIS = "Reject no thesis information"
OAI_URL = "http://%s/record/%s"
REG_ARXIV_NUMBER = re.compile("\d+\.\d+")
......
......@@ -5,7 +5,7 @@
import re
import regex
from base import OAI_URL, REG_OAI, REG_YEAR
from base import MSG_NO_CONF, MSG_NO_THESIS, OAI_URL, REG_OAI, REG_YEAR
from exception import CheckException
from filters import CLEAN_REVIEW
from gluon import current
......@@ -464,6 +464,30 @@ class CheckAndFix(object):
value = value.replace('U.', university)
record[u'502']['b'][i] = value
def is_conference(self, record):
"""Check that the record described a conference talk / proceeding.
@type record: L{Record}
@param record:
@raise CheckException
"""
if not isinstance(record, RecordConf):
raise CheckException(MSG_NO_CONF)
def is_thesis(self, record):
"""Check that the record described a conference talk / proceeding.
@type record: L{Record}
@param record:
@raise CheckException
"""
if not isinstance(record, RecordThesis):
raise CheckException(MSG_NO_THESIS)
def my_authors(self, record, reference=[], cmpFct=None):
"""Check that authors of my institutes signed the record.
Fill the meta data record.my_authors.
......
......@@ -5,7 +5,7 @@
import re
from base import is_conference, is_institute, is_thesis
from base import is_conference, is_institute, is_thesis, MSG_NO_CONF
from exception import Marc12Exception
from inveniostore import InvenioStore
from iterrecord import IterRecord
......@@ -14,7 +14,6 @@ from recordinst import RecordInst
from recordpubli import RecordPubli
from recordthesis import RecordThesis
MSG_NO_CONF = "Reject no conference information"
REG_CONF = re.compile("^C\d+-\d+-\d+(\.\d+)?$")
......
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