Commit 817fda77 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Use search_synonym in the controller edit_insert.

parent a406fb2d
......@@ -10,6 +10,7 @@ from harvest_tools import (build_harvester_tool,
DRY_RUN,
format_author_fr,
family_name_fr,
search_synonym,
ToolException)
from invenio_tools import (CheckAndFix,
CheckException,
......@@ -145,8 +146,15 @@ def edit_insert():
values['PublicationsAuthors_institute'] = record.my_authors
# collaboration
recId = get_id(db.collaborations, collaboration=record.collaboration())
values['PublicationsId_collaborations'] = int(recId) if recId else UNDEF_ID
recId = UNDEF_ID
try:
recId = search_synonym(db.collaborations,
"collaboration",
record.collaboration())
except ToolException:
pass
values['PublicationsId_collaborations'] = int(recId)
# teams, project, categories, origin
values['PublicationsId_categories'] = int(selector.id_categories)
......@@ -160,8 +168,15 @@ def edit_insert():
check.clean_erratum(record)
check.format_editor(record)
recId = get_id(db.publishers, abbreviation=record.paper_editor())
values['PublicationsId_publishers'] = int(recId) if recId else UNDEF_ID
recId = UNDEF_ID
try:
recId = search_synonym(db.publishers,
"abbreviation",
record.paper_editor())
except ToolException:
pass
values['PublicationsId_publishers'] = int(recId)
values['PublicationsVolume'] = record.paper_volume()
values['PublicationsPages'] = record.paper_pages()
......@@ -181,10 +196,15 @@ def edit_insert():
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 = UNDEF_ID
try:
recId = search_synonym(db.countries,
"country",
record.conference_country())
except ToolException:
pass
values['PublicationsId_countries'] = int(recId)
values['PublicationsConference_speaker'] = record.first_author()
# thesis
......
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