Commit 386c8e3d authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Add the processing behind the wizard AffiliationFromInstituteDb.

parent 5dcbb1cf
......@@ -8,6 +8,7 @@ import re
from check_tools import check_publication
from gluon.storage import Storage
from harvest_tools import DRY_RUN
from invenio_tools import load_record
from plugin_dbui import (CALLBACK_ERRORS,
inline_alert,
is_foreign_field,
......@@ -29,6 +30,21 @@ def affiliation_institute():
# shortcuts
institute_id = request.vars.institute_id
# find the record for the institute
record = load_record("inspirehep.net", institute_id)
if record is None:
raise HTTP(500, "Record not found!")
# extract keys defining the affiliation
rule_1 = dict(u=record[u"110"]["u"], v="")
rule_2 = dict(u=record[u"110"]["t"], v="")
# check that the rules does not exist
# load new rules
for rule in (rule_1, rule_2):
if get_id(db.affiliation_rules, **rule) is None:
db.affiliation_rules[0] = rule
return
......@@ -43,6 +59,14 @@ def affiliation_publication():
publication_id = vars.publication_id
publication_store = vars.publication_store
# find the record for the institute
# extract the keys defining the affiliation
# check that the rules does not exist
# load new rules
return
......
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