-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
openaire: openaire link on record detail page
* Adds link from record to OpenAIRE version of record. (closes #1115)
- Loading branch information
Showing
4 changed files
with
76 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of Zenodo. | ||
# Copyright (C) 2017 CERN. | ||
# | ||
# Zenodo is free software; you can redistribute it | ||
# and/or modify it under the terms of the GNU General Public License as | ||
# published by the Free Software Foundation; either version 2 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# Zenodo is distributed in the hope that it will be | ||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Zenodo; if not, write to the | ||
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
# MA 02111-1307, USA. | ||
# | ||
# In applying this license, CERN does not | ||
# waive the privileges and immunities granted to it by virtue of its status | ||
# as an Intergovernmental Organization or submit itself to any jurisdiction. | ||
|
||
"""Blueprint for OpenAIRE.""" | ||
|
||
from __future__ import absolute_import, print_function | ||
|
||
import copy | ||
from operator import itemgetter | ||
|
||
import idutils | ||
import six | ||
from flask import Blueprint, current_app, render_template, request | ||
from flask_principal import ActionNeed | ||
|
||
from .helpers import is_openaire_dataset, is_openaire_publication, \ | ||
openaire_link | ||
|
||
blueprint = Blueprint( | ||
'zenodo_openaire', | ||
__name__ | ||
) | ||
|
||
|
||
@blueprint.app_template_filter('is_openaire_publication') | ||
def is_publication(record): | ||
"""Test if record is an OpenAIRE publication.""" | ||
return is_openaire_publication(record) | ||
|
||
|
||
@blueprint.app_template_filter('is_openaire_dataset') | ||
def is_dataset(record): | ||
"""Test if record is an OpenAIRE dataset.""" | ||
return is_openaire_publication(record) | ||
|
||
|
||
@blueprint.app_template_filter('openaire_link') | ||
def link(record): | ||
"""Generate an OpenAIRE link.""" | ||
return openaire_link(record) |
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.