From beaa61362aed31f229c935a347e382024eee5a90 Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Mon, 5 Feb 2018 12:22:49 +0000 Subject: Dynamic route loader; proper application structure Also fixed flake8-imports getting the other wrong --- pysite/views/error_handlers/__init__.py | 3 +++ pysite/views/error_handlers/http_404.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 pysite/views/error_handlers/__init__.py create mode 100644 pysite/views/error_handlers/http_404.py (limited to 'pysite/views/error_handlers') diff --git a/pysite/views/error_handlers/__init__.py b/pysite/views/error_handlers/__init__.py new file mode 100644 index 00000000..ba286add --- /dev/null +++ b/pysite/views/error_handlers/__init__.py @@ -0,0 +1,3 @@ +# coding=utf-8 + +__author__ = "Gareth Coles" diff --git a/pysite/views/error_handlers/http_404.py b/pysite/views/error_handlers/http_404.py new file mode 100644 index 00000000..eea1e630 --- /dev/null +++ b/pysite/views/error_handlers/http_404.py @@ -0,0 +1,14 @@ +# coding=utf-8 +from werkzeug.exceptions import NotFound + +from pysite.base_route import ErrorView + +__author__ = "Gareth Coles" + + +class Error404View(ErrorView): + name = "error_404" + error_code = 404 + + def get(self, error: NotFound): + return "replace me with a template, 404 not found", 404 -- cgit v1.2.3