forked from rero/rero-ils
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
persons: fixes removing persons records when document is suppressed
* Fix indexer schema mapping for mef authorities * Reforctoring of document listeners using MefPerson class * Closes rero#601 Co-Authored-by: Renaud Michotte <renaud.michotte@gmail.com>
- Loading branch information
Showing
6 changed files
with
82 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from flask import current_app | ||
from requests import codes as requests_codes | ||
from requests import get as requests_get | ||
|
||
|
||
def resolve_mef_uri(uri): | ||
"""Resolve a mef uri to get associated data. | ||
Call the external resource corresponding to the uri and get the associated | ||
data if data are valid | ||
:return associated uri data as a dictionnary ; Return None if resolution | ||
failed or data are inconsistant | ||
""" | ||
mef_url = uri.replace( | ||
'mef.rero.ch', | ||
current_app.config['RERO_ILS_MEF_HOST'] | ||
) | ||
r = requests_get(url=mef_url, params={'resolve': 1, 'sources': 1}) | ||
if r.status_code == requests_codes.ok: | ||
data = r.json() | ||
if data.get('id'): | ||
return data |