Commit 87e27cdb authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Merge branch 'master' into 'production'

Release 0.9.5.6

* Update to harvest true inspirehep collection like `HAL Hidden`

See merge request !73
parents b5061055 895e7d4e
......@@ -2,6 +2,9 @@
HEAD
0.9.5.6 (Jul 2016)
- Update to harvest true inspirehep collection like HAL Hidden.
0.9.5.5 (Jun 2016)
- Require plugin_dbui 0.9.0 or higher.
- Change the javascript namespaces to Dbui and Limbra.
......
0.9.5.5
\ No newline at end of file
0.9.5.6
\ No newline at end of file
......@@ -28,6 +28,10 @@ MSG_NSERT_FAIL = "Fail to insert the new record in the database."
MSG_NO_OAI = "Reject no OAI identifier"
MSG_WELL_FORM_OAI = "Reject OAI is not well formed"
# search collection when using inspirehep
# require for "Hal Hidden"
REG_COLLECTION = re.compile(r"cc([A-Za-z ]+)(and|$)")
class Automaton(object):
"""Base class to search and process publications:
......@@ -299,6 +303,15 @@ class Automaton(object):
sf='year', # sort by date
so='d') # descending order
# handle the cc keyword (true inspirehep collection)
match = REG_COLLECTION.search(query)
if match:
dic["cc"] = match.group(1).strip()
dic["p"] = REG_COLLECTION.sub("", query).strip()
dic["p"] = dic["p"].replace(" ", " ")
if dic["p"] == "find":
del dic["p"]
# CERN INVENIO store
else:
......
......@@ -73,7 +73,10 @@ class Record(dict):
val = []
for el in self[field]:
if subfield in el:
val.append(el[subfield])
if isinstance(el[subfield], list):
val.extend(el[subfield])
else:
val.append(el[subfield])
if force_list and not isinstance(val, list):
if 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