Commit be39ed6d authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Propagate the method _insert_in_db to all automatons.

parent bc78f8c5
......@@ -284,6 +284,7 @@ class Articles(Automaton):
# eventually insert a new articles in the database
# try to improve the rescue list for CPPM authors
ret = 1
if not self.dry_run:
ret = self._insert_in_db(log_year=year,
......@@ -312,10 +313,8 @@ class Articles(Automaton):
id_team=self.id_team,
year=year)
self.logs[-1].load(MSG_LOAD, year)
else:
ret = 1
if ret == 1:
self.logs[-1].load(MSG_LOAD, year)
return 1
return ret
return 0
......@@ -83,20 +83,25 @@ class Notes(Automaton):
return status
# eventually insert a new report
ret = 1
if not self.dry_run:
db.publications.insert(authors=record.authors(),
authors_institute=record.my_authors,
first_author=first_author,
id_categories=self.id_category,
id_projects=self.id_project,
id_status=UNDEF_ID,
id_teams=self.id_team,
origin=oai_url,
publication_url=record.paper_url(),
report_numbers=record.report_number(),
submitted=record.submitted()[0],
title=title,
year=year)
self.logs[-1].load(MSG_LOAD, year)
return 1
ret = self._insert_in_db(log_year=year,
authors=record.authors(),
authors_institute=record.my_authors,
first_author=first_author,
id_categories=self.id_category,
id_projects=self.id_project,
id_status=UNDEF_ID,
id_teams=self.id_team,
origin=oai_url,
publication_url=record.paper_url(),
report_numbers=record.report_number(),
submitted=record.submitted()[0],
title=title,
year=year)
if ret == 1:
self.logs[-1].load(MSG_LOAD, year)
return 1
return 0
......@@ -111,22 +111,26 @@ class Preprints(Automaton):
return status
# eventually insert a new preprint
ret = 1
if not self.dry_run:
db.publications.insert(authors=record.authors(),
authors_institute=record.my_authors,
first_author=first_author,
id_categories=self.id_category,
id_collaborations=id_collaboration,
id_projects=self.id_project,
id_status=UNDEF_ID,
id_teams=self.id_team,
origin=oai_url,
preprint=preprint,
publication_url=record.paper_url(),
submitted=submitted,
title=title,
year=year)
self.logs[-1].load(MSG_LOAD, year)
return 1
ret = self._insert_in_db(log_year=year,
authors=record.authors(),
authors_institute=record.my_authors,
first_author=first_author,
id_categories=self.id_category,
id_collaborations=id_collaboration,
id_projects=self.id_project,
id_status=UNDEF_ID,
id_teams=self.id_team,
origin=oai_url,
preprint=preprint,
publication_url=record.paper_url(),
submitted=submitted,
title=title,
year=year)
if ret == 1:
self.logs[-1].load(MSG_LOAD, year)
return 1
return 0
......@@ -119,6 +119,7 @@ class Proceedings(Automaton):
return status
# eventually insert a new proceeding
ret = 1
if not self.dry_run:
dic = dict(authors=authors,
......@@ -146,7 +147,10 @@ class Proceedings(Automaton):
volume=volume,
year=year)
db.publications[0] = dic
ret = self._insert_in_db(log_year=year, **di)
self.logs[-1].load(MSG_LOAD, year)
return 1
if ret == 1:
self.logs[-1].load(MSG_LOAD, year)
return 1
return 0
......@@ -102,22 +102,27 @@ class Reports(Automaton):
return status
# eventually insert a new report
ret = 1
if not self.dry_run:
db.publications.insert(authors=authors,
authors_institute=authors_institute,
first_author=first_author,
id_categories=self.id_category,
id_collaborations=id_collaboration,
id_projects=self.id_project,
id_status=id_status,
id_teams=self.id_team,
origin=oai_url,
preprint=record.preprint_number(),
publication_url=record.paper_url(),
report_numbers=record.report_number(),
submitted=record.submitted()[0],
title=title,
year=year)
self.logs[-1].load(MSG_LOAD, year)
return 1
ret = self._insert_in_db(log_year=year,
authors=authors,
authors_institute=authors_institute,
first_author=first_author,
id_categories=self.id_category,
id_collaborations=id_collaboration,
id_projects=self.id_project,
id_status=id_status,
id_teams=self.id_team,
origin=oai_url,
preprint=record.preprint_number(),
publication_url=record.paper_url(),
report_numbers=record.report_number(),
submitted=record.submitted()[0],
title=title,
year=year)
if ret == 1:
self.logs[-1].load(MSG_LOAD, year)
return 1
return 0
......@@ -94,25 +94,30 @@ class Talks(Automaton):
return status
# eventually insert a new talk
ret = 1
if not self.dry_run:
db.publications.insert(authors=record.authors(),
authors_institute=record.my_authors,
conference_dates=conference_dates,
conference_speaker=first_author,
conference_title=conference_title,
conference_town=record.conference_town(),
conference_url=record.conference_url(),
first_author=first_author,
id_categories=self.id_category,
id_collaborations=id_collaboration,
id_countries=id_country,
id_projects=self.id_project,
id_status=UNDEF_ID,
id_teams=self.id_team,
origin=oai_url,
submitted=submitted,
title=title,
year=year)
self.logs[-1].load(MSG_LOAD, year)
return 1
ret = self._insert_in_db(log_year=year,
authors=record.authors(),
authors_institute=record.my_authors,
conference_dates=conference_dates,
conference_speaker=first_author,
conference_title=conference_title,
conference_town=record.conference_town(),
conference_url=record.conference_url(),
first_author=first_author,
id_categories=self.id_category,
id_collaborations=id_collaboration,
id_countries=id_country,
id_projects=self.id_project,
id_status=UNDEF_ID,
id_teams=self.id_team,
origin=oai_url,
submitted=submitted,
title=title,
year=year)
if ret == 1:
self.logs[-1].load(MSG_LOAD, year)
return 1
return 0
......@@ -99,22 +99,27 @@ class Thesis(Automaton):
return status
# eventually insert a new thesis
ret = 1
if not self.dry_run:
db.publications.insert(authors=first_author,
authors_institute=first_author,
defense=defense_date,
directors=record.these_directors(),
first_author=first_author,
id_categories=id_category,
id_teams=self.id_team,
id_projects=self.id_project,
id_status=UNDEF_ID,
origin=oai_url,
publication_url=record.paper_url(),
submitted=record.submitted()[0],
title=title,
universities=universities,
year=year)
self.logs[-1].load(MSG_LOAD, year)
return 1
ret = self._insert_in_db(log_year=year,
authors=first_author,
authors_institute=first_author,
defense=defense_date,
directors=record.these_directors(),
first_author=first_author,
id_categories=id_category,
id_teams=self.id_team,
id_projects=self.id_project,
id_status=UNDEF_ID,
origin=oai_url,
publication_url=record.paper_url(),
submitted=record.submitted()[0],
title=title,
universities=universities,
year=year)
if ret == 1:
self.logs[-1].load(MSG_LOAD, year)
return 1
return 0
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