Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Crossref deposits for publications without an ISSN #1430

Merged
merged 3 commits into from
Feb 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/identifiers/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from django.urls import reverse
from django.template.loader import render_to_string
from django.utils.http import urlencode
from django.conf import settings
from django.contrib import messages
from django.utils import timezone

Expand Down Expand Up @@ -66,7 +67,9 @@ def register_crossref_component(article, xml, supp_file):
logger.info("[DOI] Not using Crossref DOIs on this journal. Aborting registration.")
return

test_mode = setting_handler.get_setting('Identifiers', 'crossref_test', article.journal).processed_value
test_mode = setting_handler.get_setting(
'Identifiers', 'crossref_test', article.journal
).processed_value or settings.DEBUG

server = test_url if test_mode else live_url

Expand Down Expand Up @@ -148,14 +151,15 @@ def send_crossref_deposit(server, identifier):
'Info',
target=identifier.article)

logger.debug("[CROSSREF:DEPOSIT:%s] Sending to %s" % (identifier.article.id, server))
response = requests.post(server, data=crossref_template.encode('utf-8'),
auth=(setting_handler.get_setting('Identifiers',
'crossref_username',
identifier.article.journal).processed_value,
setting_handler.get_setting('Identifiers', 'crossref_password',
identifier.article.journal).processed_value),
headers={"Content-Type": "application/vnd.crossref.deposit+xml"})

logger.debug("[CROSSREF:DEPOSIT:%s] Response code %s" % (identifier.article.id, response.status_code))
if response.status_code != 200:
util_models.LogEntry.add_entry('Error',
"Error depositing: {0}. {1}".format(response.status_code, response.text),
Expand Down
2 changes: 2 additions & 0 deletions src/templates/common/identifiers/crossref.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
<journal>
<journal_metadata>
<full_title>{{ journal_title }}</full_title>
{% if journal_issn and journal_issn != '0000-0000' %}
<issn media_type="electronic">{{ journal_issn }}</issn>
{% endif %}
</journal_metadata>
{% if issue %}
<journal_issue>
Expand Down