templates_staticdir = $(templatesdir)/static
templates_wiki_DATA = \
+ src/templates/wiki/404.html \
src/templates/wiki/base.html \
src/templates/wiki/page.html \
src/templates/wiki/recent-changes.html
--- /dev/null
+{% extends "../base.html" %}
+
+{% block title %}{{ _("Page Not Found") }}{% end block %}
+
+{% block container %}
+ <section>
+ <div class="container">
+ <div class="row justify-content-center mt-5">
+ <div class="col col-md-7">
+ <h5 class="mb-0">{{ _("Error 404") }}</h5>
+
+ <h2>{{ _("This Page Does Not Exist") }}</h2>
+
+ <p>
+ {{ _("This wiki page does not exist, yet.") }}
+ </p>
+
+ <a class="btn btn-primary btn-block" href="{{ request.path }}?action=edit">
+ {{ _("Create Now") }}
+ </a>
+ </div>
+ </div>
+ </div>
+ </section>
+{% end block %}
from . import ui_modules
class PageHandler(auth.CacheMixin, base.BaseHandler):
+ def write_error(self, status_code, **kwargs):
+ # Render a custom page for 404
+ if status_code == 404:
+ self.render("wiki/404.html", **kwargs)
+ return
+
+ # Otherwise raise this to one layer above
+ super().write_error(status_code, **kwargs)
+
@tornado.web.removeslash
def get(self, page):
page = self.backend.wiki.get_page(page)