Commit 4041a90e authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Remove the obsolete method check_by_origin except for article.

parent ce871bd1
......@@ -129,7 +129,7 @@ class Articles(PublicationsTool):
volume=volume,
year=year)
# fix orign field
# fix origin field
if rec_id and not db.publications[rec_id].origin:
if not self.dry_run:
db.publications[rec_id] = dict(origin=oai_url)
......
......@@ -36,10 +36,6 @@ class Notes(PublicationsTool):
year = record.year()
# check against already published notes
rec_id, status = self.check_by_origin(oai_url=oai_url, year=year)
if rec_id:
return status
rec_id, status = self.check_by_fields(first_author=first_author,
id_categories=self.id_category,
id_projects=self.id_project,
......
......@@ -47,10 +47,6 @@ class Preprints(PublicationsTool):
id_collaboration = self.check_collaboration(record.collaboration())
# check against preprint or article already published
rec_id, status = self.check_by_origin(oai_url=oai_url, year=year)
if rec_id:
return status
rec_id, status = self.check_by_fields(first_author=first_author,
id_projects=self.id_project,
id_teams=self.id_team,
......
......@@ -36,12 +36,6 @@ class Proceedings(PublicationsTool):
if not year:
year = record.year()
# check against already published proceeding using the field origin
rec_id, status = self.check_by_origin(oai_url=oai_url, year=year)
if rec_id:
return status
# alias
authors = record.authors()
editor = record.paper_editor()
......
......@@ -135,8 +135,10 @@ class PublicationsTool(object):
"""
db = self.db
harvester = self.harvester
url = OAI_URL % (self.harvester.host, rec_id)
# check
url = OAI_URL % (harvester.host, rec_id)
db_id = get_id(db.publications, origin=url)
if db_id is None:
......@@ -144,6 +146,13 @@ class PublicationsTool(object):
publication = db.publications[db_id]
# same category for the publication and the harvester
# keep the record if it is not the case
# this is required to transform a preprint into article
if publication.id_categories != harvester.id_categories:
return False
# log
self.logs.append(Msg(harvester=self.harvester,
collection=title,
record_id=rec_id,
......@@ -279,36 +288,6 @@ class PublicationsTool(object):
return self.__reference
def check_by_origin(self, oai_url=None, year=None):
"""Check that a record already exist using the origin field.
- Actions are logged.
@type oai_url: unicode
@param oai_url: typical value is "http://cds.cern.ch/record/123456"
@type year: unicode
@param year:
@note: this method can be customised in inherited class
to perform dedicated action.
@rtype: tuple
@return: the tuple (id, status). The id of the record or None.
The status is equal to one when the existing record was modified
zero otherwise
"""
if self.dbg:
print "check existing record by origin"
rec_id = get_id(self.db.publications, origin=oai_url)
if not rec_id:
return (None, 0)
self.logs[-1].idle(MSG_IN_DB, year)
return (rec_id, 0)
def check_by_fields(self, **kwargs):
"""Check that a record already exist using the fields defined
in the keyword arguments.
......
......@@ -55,10 +55,6 @@ class Reports(PublicationsTool):
id_collaboration = self.check_collaboration(record.collaboration())
# check against already published reports
rec_id, status = self.check_by_origin(oai_url=oai_url, year=year)
if rec_id:
return status
rec_id, status = self.check_by_fields(id_categories=self.id_category,
id_projects=self.id_project,
id_teams=self.id_team,
......
......@@ -32,11 +32,6 @@ class Talks(PublicationsTool):
oai_url = record.oai_url()
year = record.year()
# check against already published talk using the origin field
rec_id, status = self.check_by_origin(oai_url=oai_url, year=year)
if rec_id:
return status
# alias for the conference information
conference_dates = record.conference_dates()
conference_title = record.conference_title()
......
......@@ -46,10 +46,6 @@ class Thesis(PublicationsTool):
year = re.search(r"(\d\d\d\d)", defense_date).group(1)
# check against already published thesis
rec_id, status = self.check_by_origin(oai_url=oai_url, year=year)
if rec_id:
return status
rec_id, status = self.check_by_fields(first_author=first_author,
defense=defense_date,
id_projects=self.id_project,
......
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