aboutsummaryrefslogtreecommitdiffstats
path: root/pysite/base_route.py
diff options
context:
space:
mode:
authorGravatar Gareth Coles <[email protected]>2018-04-08 01:07:41 +0100
committerGravatar Gareth Coles <[email protected]>2018-04-08 01:07:41 +0100
commit8235adbecdf09ffe2e8b7a04a38d0be2d86fd5d4 (patch)
treec126eef18d6bb10306d577bb5673a1f2a1bb2e88 /pysite/base_route.py
parent[Wiki] Shorten edit/view links in sidebar (diff)
Easier debugging and optimised imports
Simply set FLASK_DEBUG=1 in your env to skip OAuth checks
Diffstat (limited to 'pysite/base_route.py')
-rw-r--r--pysite/base_route.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/pysite/base_route.py b/pysite/base_route.py
index 494875ed..1d30669d 100644
--- a/pysite/base_route.py
+++ b/pysite/base_route.py
@@ -6,7 +6,7 @@ from flask import Blueprint, Response, jsonify, render_template, url_for
from flask.views import MethodView
from werkzeug.exceptions import default_exceptions
-from pysite.constants import ErrorCodes
+from pysite.constants import DEBUG_MODE, ErrorCodes
from pysite.mixins import OauthMixin
@@ -52,6 +52,7 @@ class BaseView(MethodView, OauthMixin):
context["view"] = self
context["logged_in"] = self.logged_in
context["static_file"] = self._static_file
+ context["debug"] = DEBUG_MODE
return render_template(template_names, **context)
@@ -204,4 +205,5 @@ class ErrorView(BaseView):
else:
blueprint.errorhandler(code)(cls.as_view(cls.name))
else:
- raise RuntimeError("Error views must have an `error_code` that is either an `int` or an iterable") # pragma: no cover # noqa: E501
+ raise RuntimeError(
+ "Error views must have an `error_code` that is either an `int` or an iterable") # pragma: no cover # noqa: E501