SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
47b388e8
Commit
47b388e8
authored
5 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Add 302 redirect to latest vn of submission pdf for Google Scholar
parent
58ec73d6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
preprints/urls.py
+7
-2
7 additions, 2 deletions
preprints/urls.py
preprints/views.py
+10
-0
10 additions, 0 deletions
preprints/views.py
submissions/constants.py
+0
-1
0 additions, 1 deletion
submissions/constants.py
with
17 additions
and
3 deletions
preprints/urls.py
+
7
−
2
View file @
47b388e8
...
...
@@ -6,10 +6,15 @@ from django.conf.urls import url
from
.
import
views
from
submissions.constants
import
S
CIPOST_PREPRINT_W_VN
_REGEX
from
submissions.constants
import
S
UBMISSIONS_NO_VN_REGEX
,
SUBMISSIONS_COMPLETE
_REGEX
app_name
=
'
preprints
'
urlpatterns
=
[
url
(
r
'
^{regex}/$
'
.
format
(
regex
=
SCIPOST_PREPRINT_W_VN_REGEX
),
views
.
preprint_pdf
,
name
=
'
pdf
'
),
url
(
r
'
^{regex}/$
'
.
format
(
regex
=
SUBMISSIONS_NO_VN_REGEX
),
views
.
preprint_latest_pdf
,
name
=
'
latest_pdf
'
),
url
(
r
'
^{regex}/$
'
.
format
(
regex
=
SUBMISSIONS_COMPLETE_REGEX
),
views
.
preprint_pdf
,
name
=
'
pdf
'
),
]
This diff is collapsed.
Click to expand it.
preprints/views.py
+
10
−
0
View file @
47b388e8
...
...
@@ -5,6 +5,7 @@ import os
from
django.http
import
Http404
,
HttpResponse
from
django.shortcuts
import
get_object_or_404
,
redirect
from
django.urls
import
reverse
from
submissions.helpers
import
check_verified_author
from
submissions.models
import
Submission
...
...
@@ -39,3 +40,12 @@ def preprint_pdf(request, identifier_w_vn_nr):
filename
=
'
{}{}
'
.
format
(
preprint
.
identifier_w_vn_nr
,
extension
)
response
[
'
Content-Disposition
'
]
=
(
'
filename=
'
+
filename
)
return
response
def
preprint_latest_pdf
(
request
,
identifier_wo_vn_nr
):
submission
=
Submission
.
objects
.
filter
(
preprint__identifier_wo_vn_nr
=
identifier_wo_vn_nr
).
first
()
if
not
submission
:
raise
Http404
return
redirect
(
reverse
(
'
preprints:pdf
'
,
args
=
[
submission
.
get_latest_version
().
preprint
.
identifier_w_vn_nr
,]))
This diff is collapsed.
Click to expand it.
submissions/constants.py
+
0
−
1
View file @
47b388e8
...
...
@@ -277,7 +277,6 @@ scipost_regex_wo_vn = 'scipost_[0-9]{4,}_[0-9]{4,}'
scipost_regex_w_vn
=
'
scipost_[0-9]{4,}_[0-9]{4,}v[0-9]{1,2}
'
SUBMISSIONS_NO_VN_REGEX
=
'
(?P<identifier_wo_vn_nr>(%s|%s))
'
%
(
arxiv_regex_wo_vn
,
scipost_regex_wo_vn
)
SUBMISSIONS_COMPLETE_REGEX
=
'
(?P<identifier_w_vn_nr>(%s|%s))
'
%
(
arxiv_regex_w_vn
,
scipost_regex_w_vn
)
SCIPOST_PREPRINT_W_VN_REGEX
=
'
(?P<identifier_w_vn_nr>%s)
'
%
scipost_regex_w_vn
# `EXPLICIT_REGEX_MANUSCRIPT_CONSTRAINTS` tracks the regex rules for the manuscripts
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment