-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11784 from archesproject/jtw/custom-error-handlers
Restore custom error views (but return JSON where desired) #11722
- Loading branch information
Showing
11 changed files
with
153 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{% extends "errors/error_base.htm" %} | ||
{% load i18n %} | ||
{% load static %} | ||
|
||
{% block body %} | ||
<div style="text-align: center"> | ||
<!--===================================================--> | ||
<div class="cls-header"> | ||
<div class="cls-brand"> | ||
<a class="box-inline" href="/index.html"> | ||
<span class="brand-title"><h4>{% trans "Arches" %}</h4></span> | ||
</a> | ||
</div> | ||
</div> | ||
|
||
<!-- CONTENT --> | ||
<!--===================================================--> | ||
<div class="cls-content"> | ||
<h1 class="error-code text-primary">{% trans "Oops!" %}</h1> | ||
<p class="h3 text-uppercase">{% trans "Bad Request" %}</p> | ||
<div class="pad-btm"> | ||
{% trans "Something went wrong and we couldn't process your request." %}" | ||
</div> | ||
|
||
<hr class="new-section-sm bord-no"> | ||
<div class="pad-top"><a class="btn-link" href="/index.html">{% trans "Back to Homepage" %}</a></div> | ||
</div> | ||
</div> | ||
{% endblock body %} |
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,29 @@ | ||
{% extends "errors/error_base.htm" %} | ||
{% load i18n %} | ||
{% load static %} | ||
|
||
{% block body %} | ||
<div style="text-align: center"> | ||
<!--===================================================--> | ||
<div class="cls-header"> | ||
<div class="cls-brand"> | ||
<a class="box-inline" href="/index.html"> | ||
<span class="brand-title"><h4>{% trans "Arches" %}</h4></span> | ||
</a> | ||
</div> | ||
</div> | ||
|
||
<!-- CONTENT --> | ||
<!--===================================================--> | ||
<div class="cls-content"> | ||
<h1 class="error-code text-primary">{% trans "Oops!" %}</h1> | ||
<p class="h3 text-uppercase">{% trans "Access Denied" %}</p> | ||
<div class="pad-btm"> | ||
{% trans "You don't have permission to access this resource." %}" | ||
</div> | ||
|
||
<hr class="new-section-sm bord-no"> | ||
<div class="pad-top"><a class="btn-link" href="/index.html">{% trans "Back to Homepage" %}</a></div> | ||
</div> | ||
</div> | ||
{% endblock body %} |
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,17 @@ | ||
def looks_like_api_call(request): | ||
known_api_paths_without_api_signposting = [ | ||
# Until these are renamed for consistency, just list them. | ||
"arches.app.views.workflow_history", | ||
] | ||
if "/api/" in request.path: | ||
return True | ||
if not request.resolver_match: | ||
return False | ||
if ".api." in request.resolver_match.func.__module__: | ||
return True | ||
if ( | ||
request.resolver_match.func.__module__ | ||
in known_api_paths_without_api_signposting | ||
): | ||
return True | ||
return False |
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