aboutsummaryrefslogtreecommitdiffstats
path: root/pysite/views
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/views
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/views')
-rw-r--r--pysite/views/error_handlers/http_4xx.py6
-rw-r--r--pysite/views/error_handlers/http_5xx.py6
-rw-r--r--pysite/views/wiki/page.py4
3 files changed, 8 insertions, 8 deletions
diff --git a/pysite/views/error_handlers/http_4xx.py b/pysite/views/error_handlers/http_4xx.py
index 48ae7f0f..2d6c54c6 100644
--- a/pysite/views/error_handlers/http_4xx.py
+++ b/pysite/views/error_handlers/http_4xx.py
@@ -11,7 +11,6 @@ class Error400View(ErrorView):
error_code = range(400, 430)
def __init__(self):
-
# Direct errors for all methods at self.return_error
methods = [
'get', 'post', 'put',
@@ -27,7 +26,6 @@ class Error400View(ErrorView):
return self.render(
"errors/error.html", code=error.code, req=request, error_title=error_desc,
- error_message=error_desc +
- " If you believe we have made a mistake, please "
- "<a href='https://github.com/discord-python/site/issues'>open an issue on our GitHub</a>."
+ error_message=f"{error_desc} If you believe we have made a mistake, please "
+ "<a href='https://github.com/discord-python/site/issues'>open an issue on our GitHub</a>."
), error.code
diff --git a/pysite/views/error_handlers/http_5xx.py b/pysite/views/error_handlers/http_5xx.py
index 14c016c5..46c65e38 100644
--- a/pysite/views/error_handlers/http_5xx.py
+++ b/pysite/views/error_handlers/http_5xx.py
@@ -36,7 +36,7 @@ class Error500View(ErrorView):
return self.render(
"errors/error.html", code=error.code, req=request, error_title=error_desc,
error_message="An error occurred while processing this request, please try "
- "again later. If you believe we have made a mistake, please "
- "<a href='https://github.com/discord-python/site/issues'>file an issue on our"
- " GitHub</a>."
+ "again later. If you believe we have made a mistake, please "
+ "<a href='https://github.com/discord-python/site/issues'>file an issue on our"
+ " GitHub</a>."
), error.code
diff --git a/pysite/views/wiki/page.py b/pysite/views/wiki/page.py
index a7e4de51..a7f60f02 100644
--- a/pysite/views/wiki/page.py
+++ b/pysite/views/wiki/page.py
@@ -3,7 +3,7 @@ from flask import redirect, url_for
from werkzeug.exceptions import NotFound
from pysite.base_route import RouteView
-from pysite.constants import EDITOR_ROLES
+from pysite.constants import DEBUG_MODE, EDITOR_ROLES
from pysite.mixins import DBMixin
@@ -25,6 +25,8 @@ class PageView(RouteView, DBMixin):
return self.render("wiki/page_view.html", page=page, data=obj, can_edit=self.is_staff())
def is_staff(self):
+ if DEBUG_MODE:
+ return True
if not self.logged_in:
return False