Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-wiki
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-wiki
Commits
876357a6
Commit
876357a6
authored
Aug 21, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added an error page (for when even the parent isn't found).
parent
e237b2ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
wiki/decorators.py
+3
-3
wiki/templates/wiki/error.html
+27
-0
No files found.
wiki/decorators.py
View file @
876357a6
...
...
@@ -4,7 +4,7 @@ from django.core.urlresolvers import reverse
from
django.shortcuts
import
redirect
,
get_object_or_404
from
django.template.context
import
RequestContext
from
django.http
import
HttpResponse
,
HttpResponseNotFound
,
\
HttpResponseForbidden
HttpResponseForbidden
,
HttpResponse
from
django.utils
import
simplejson
as
json
from
wiki.core.exceptions
import
NoRootURL
...
...
@@ -61,8 +61,8 @@ def get_article(func=None, can_read=True, can_write=False, deleted_contents=Fals
parent
=
models
.
URLPath
.
get_by_path
(
path
)
return
redirect
(
reverse
(
"wiki:create"
,
kwargs
=
{
'path'
:
parent
.
path
,})
+
"?slug=
%
s"
%
pathlist
[
-
1
])
except
models
.
URLPath
.
DoesNotExist
:
# TODO: Make a nice page
return
HttpResponseNotFound
(
"This article was not found, and neither was the parent. This page should look nicer."
)
c
=
RequestContext
(
request
,
{
'error_type'
:
'ancestors_missing'
})
return
HttpResponseNotFound
(
render_to_string
(
"wiki/error.html"
,
context_instance
=
c
)
)
if
urlpath
.
article
:
# urlpath is already smart about prefetching items on article (like current_revision), so we don't have to
article
=
urlpath
.
article
...
...
wiki/templates/wiki/error.html
0 → 100644
View file @
876357a6
{% extends "wiki/base.html" %}
{% load wiki_tags i18n %}
{% load url from future %}
{% block pagetitle %}{{ article.current_revision.title }}{% endblock %}
{% block wiki_breadcrumbs %}
{% include "wiki/includes/breadcrumbs.html" %}
{% endblock %}
{% block wiki_contents %}
{% if error_type == "ancestors_missing" %}
<div
class=
"missing"
>
<p>
This article was not found, and neither was its parent article.
<a
href=
"{% url 'wiki:get' path='' %}"
>
Go back to the main wiki article
</a></p>
</div>
{% else %}
<div
class=
"error"
>
<p>
There was some sort of error accessing this page. Sorry!
</p>
</div>
{% endif %}
{% endblock %}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment