Commit 7aeb1ccb authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Bug fixed in the decoding of the conference reference.

parent 8a6f0972
......@@ -270,6 +270,8 @@
'MARCXML': 'MARCXML',
'Metric': 'Métrique',
'metrics': 'métriques',
'Missing record for conference identified by id': 'Missing record for conference identified by id',
'Missing record for conference identified by key': 'Missing record for conference identified by key',
'Mode': 'Mode',
'Modified': 'Modifié',
'Modified By': 'Modified By',
......@@ -360,6 +362,7 @@
'Ratio': 'Ratio',
'record id': 'record id',
'Record ID': 'Record ID',
'Record not link to a conference': 'Enregistrement sans lien à une conférence',
'Records': 'Enregistrements',
'Register': 'Register',
'Registration identifier': 'Registration identifier',
......
......@@ -29,10 +29,16 @@ MSG_IN_DB = current.T("Already in the database", lazy=False)
MSG_LOAD = current.T("Load in the database", lazy=False)
MSG_MATCH = current.T("Reject the talk match a proceeding", lazy=False)
MSG_NO_AUTHOR = current.T("Reject no authors", lazy=False)
MSG_NO_CONFERENCE = current.T("Reject no conference information", lazy=False)
MSG_NO_CAT = current.T('Select a "category" !!!', lazy=False)
MSG_NO_CPPM_AUTHOR = current.T("Reject no CPPM authors", lazy=False)
MSG_NO_CONF_ID = current.T('Missing record for conference identified by id', lazy=False)
MSG_NO_CONF_KEY = current.T('Missing record for conference identified by key', lazy=False)
MSG_NO_EDITOR = current.T("Reject article is not published", lazy=False)
MSG_NO_HARVESTER = current.T('Harvester parameters not defined in the database.', lazy=False)
MSG_NO_LINK = current.T('Record not link to a conference', lazy=False)
MSG_NO_OAI = current.T("Reject no OAI identifier", lazy=False)
MSG_NO_PROJECT = current.T('Select a "project" !!!', lazy=False)
MSG_NO_TEAM = current.T('Select a "team" !!!', lazy=False)
MSG_NO_THESIS = current.T("Reject not a thesis record", lazy=False)
MSG_PREPRINT_IS_PAPER = current.T("Reject preprint is a published paper", lazy=False)
MSG_PREPRINT_IS_CONFERENCE = current.T("Reject preprint is a conference", lazy=False)
......@@ -42,15 +48,6 @@ MSG_SERVER_ERROR = current.T("Error !!!", lazy=False)
MSG_TRANSFORM_PREPRINT = current.T("Transform the preprint into an article", lazy=False)
MSG_TRANSFORM_TALK = current.T("Transform the talk into a proceeding", lazy=False)
# error messages
MSG_NO_CAT = 'Select a "category" !!!'
MSG_NO_CONF_ID = 'Missing record for conference id %s.'
MSG_NO_CONF_KEY = 'Missing record for conference key %s.'
MSG_NO_HARVESTER = 'Harvester parameters not defined in the database.'
MSG_NO_LINK = 'Record not link to a conference'
MSG_NO_PROJECT = 'Select a "project" !!!'
MSG_NO_TEAM = 'Select a "team" !!!'
class ToolException(Exception): pass
......@@ -225,14 +222,14 @@ def get_conference_record(cds, marc12, record):
id = record.reference_conference_id()
key = record.reference_conference_key()
# search the conference by id the preferred method
if id:
try:
xml = cds.get_record(id)
except invenio_tools.CdsSvcException as error:
msg = "%s %s" % (MSG_NO_CONF_ID % id, error)
msg = "%s. %s" % (MSG_NO_CONF_ID, error)
return msg
conferences = marc12.process(xml)
......@@ -240,7 +237,7 @@ def get_conference_record(cds, marc12, record):
if el.id() == id:
return el
msg = MSG_NO_CONF_ID % id
msg = MSG_NO_CONF_ID
# search the conference by key if the previous method failed.
# the method depends on the store.
......@@ -253,7 +250,7 @@ def get_conference_record(cds, marc12, record):
ids = cds.get_ids(p=key)
if not ids:
msg = "%s %s" % (msg, MSG_NO_CONF_KEY % key)
msg = "%s. %s" % (msg, MSG_NO_CONF_KEY)
return msg
for id in ids:
......@@ -261,7 +258,7 @@ def get_conference_record(cds, marc12, record):
xml = cds.get_record(id)
except invenio_tools.CdsSvcException as error:
msg = "%s %s" % (MSG_NO_CONF_KEY % key, error)
msg = "%s. %s" % (MSG_NO_CONF_KEY, error)
return msg
conferences = marc12.process(xml)
......@@ -269,7 +266,7 @@ def get_conference_record(cds, marc12, record):
if el.conference_key() == key:
return el
msg = "%s %s" % (msg, MSG_NO_CONF_KEY % key)
msg = "%s. %s" % (msg, MSG_NO_CONF_KEY)
return msg
# no id and no key
......@@ -1719,7 +1716,7 @@ class Proceedings(PublicationsTool):
id_publisher = self.check_publisher(editor)
# check against already published proceeding using the field origin
ref = record.reference_conference_talk()
ref_talk = record.reference_conference_talk()
id, status = self.check_by_origin(authors=authors,
host=host,
id_publisher=id_publisher,
......@@ -1727,7 +1724,7 @@ class Proceedings(PublicationsTool):
preprint=preprint,
pages=pages,
publication_url=url,
reference_talk=ref,
reference_talk=ref_talk,
report_numbers=report_numbers,
submitted=submitted,
volume=volume,
......@@ -1742,7 +1739,9 @@ class Proceedings(PublicationsTool):
# conference is either a Record or and error msg
if isinstance(conference, (str, unicode)):
msg = "%s. %s" % (conference.encode('utf-8'), MSG_NO_CONFERENCE)
msg = conference
if (isinstance(msg, unicode)):
msg = conference.encode('utf-8')
self.logs[-1].reject(msg)
return 0
......@@ -2062,7 +2061,7 @@ class Talks(PublicationsTool):
# conference is either a Record or and error msg
if isinstance(conference, (str, unicode)):
msg = "%s. %s" % (conference.encode('utf-8'), MSG_NO_CONFERENCE)
msg = conference.encode('utf-8')
self.logs[-1].reject(msg)
return 0
......
......@@ -1533,23 +1533,29 @@ class Record(dict):
- Empty string when not defined
"""
val = ''
# the location of this values depends on the store
# cds.cern.ch --> 962n
# inspirehep.net --> 773w
if "773" in self and "w" in self["773"]:
val = self._get("773", 'w')
# cds.cern.ch (962, n) and inspirehep.net (773,w).
#
# NOTE: for the later the field can be a dictionary or
# a list of dictionary. Two type exist. One for the
# proceeding, the other containing the conference key.
# all topologies exist, proc, conf, proc+conf
#
if "773" in self:
elif "962" in self:
val = self._get("962", 'n')
if isinstance(val, list):
if len(val):
val = val[0]
else:
val = ''
if isinstance(self["773"], dict) and "w" in self["773"]:
val = self["773"]["w"]
elif isinstance(self["773"], list):
for di in self["773"]:
if "w" in di:
val = di["w"]
elif "962" in self and "n" in self["962"]:
val = self["962"]["n"]
return val
......
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