Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
0cbf9001
Verified
Commit
0cbf9001
authored
3 years ago
by
Nik | Klampfradler
Committed by
Jonathan Weth
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Make 5xx errors work again
(cherry picked from commit
f9852851
)
parent
48eee97c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!697
Prepare release 2.0rc4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.rst
+1
-0
1 addition, 0 deletions
CHANGELOG.rst
aleksis/core/urls.py
+3
-0
3 additions, 0 deletions
aleksis/core/urls.py
aleksis/core/views.py
+13
-0
13 additions, 0 deletions
aleksis/core/views.py
with
17 additions
and
0 deletions
CHANGELOG.rst
+
1
−
0
View file @
0cbf9001
...
...
@@ -19,6 +19,7 @@ Fixed
* Use text HTTP response for serviceworker.js insteas of binary stream
* Use Django permission instead of rule to prevent performance issues.
* Correctly deliver server errors to user
`2.0rc3`_ - 2021-07-26
----------------------
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/urls.py
+
3
−
0
View file @
0cbf9001
...
...
@@ -226,6 +226,9 @@ urlpatterns = [
path
(
"
pdfs/<int:pk>/
"
,
views
.
RedirectToPDFFile
.
as_view
(),
name
=
"
redirect_to_pdf_file
"
),
]
# Use custom server error handler to get a request object in the template
handler500
=
views
.
server_error
# Add URLs for optional features
if
hasattr
(
settings
,
"
TWILIO_ACCOUNT_SID
"
):
from
two_factor.gateways.twilio.urls
import
urlpatterns
as
tf_twilio_urls
# noqa
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/views.py
+
13
−
0
View file @
0cbf9001
...
...
@@ -13,14 +13,17 @@ from django.http import (
HttpResponse
,
HttpResponseNotFound
,
HttpResponseRedirect
,
HttpResponseServerError
,
JsonResponse
,
)
from
django.shortcuts
import
get_object_or_404
,
redirect
,
render
from
django.template
import
loader
from
django.urls
import
reverse
,
reverse_lazy
from
django.utils.decorators
import
method_decorator
from
django.utils.translation
import
get_language
from
django.utils.translation
import
gettext_lazy
as
_
from
django.views.decorators.cache
import
never_cache
from
django.views.defaults
import
ERROR_500_TEMPLATE_NAME
from
django.views.generic.base
import
TemplateView
,
View
from
django.views.generic.detail
import
DetailView
,
SingleObjectMixin
from
django.views.generic.edit
import
DeleteView
,
UpdateView
...
...
@@ -1199,3 +1202,13 @@ class SocialAccountDeleteView(DeleteView):
self
.
request
,
_
(
"
The third-party account has been successfully disconnected.
"
)
)
return
HttpResponseRedirect
(
success_url
)
def
server_error
(
request
:
HttpRequest
,
template_name
:
str
=
ERROR_500_TEMPLATE_NAME
)
->
HttpResponseServerError
:
"""
Custom error view that ensures the request is passed to the error page.
"""
template
=
loader
.
get_template
(
template_name
)
context
=
{
"
request
"
:
request
}
return
HttpResponseServerError
(
template
.
render
(
context
))
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