aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Gareth Coles <[email protected]>2018-04-01 13:21:10 +0100
committerGravatar Gareth Coles <[email protected]>2018-04-01 13:21:10 +0100
commitb16b61ca43631a47279560de9c771f0e7791023e (patch)
treeb88820214a4de7765c14b94350620f38e2e1f28a
parentAdding atom (#49) (diff)
Fix logging, restrict staff index route
-rw-r--r--pysite/__init__.py2
-rw-r--r--pysite/constants.py2
-rw-r--r--pysite/route_manager.py2
-rw-r--r--pysite/views/staff/index.py3
4 files changed, 7 insertions, 2 deletions
diff --git a/pysite/__init__.py b/pysite/__init__.py
index 9aed2f66..3e11a776 100644
--- a/pysite/__init__.py
+++ b/pysite/__init__.py
@@ -34,7 +34,7 @@ if DATADOG_ADDRESS:
logging_handlers.append(StreamHandler(stream=sys.stderr))
logging.basicConfig(
- format="%(asctime)s pd.beardfist.com Site: | %(name)30s | %(levelname)8s | %(message)s",
+ format="%(asctime)s pd.beardfist.com Site: | %(name)35s | %(levelname)8s | %(message)s",
datefmt="%b %d %H:%M:%S",
level=log_level,
handlers=logging_handlers
diff --git a/pysite/constants.py b/pysite/constants.py
index 6339267d..921a32b9 100644
--- a/pysite/constants.py
+++ b/pysite/constants.py
@@ -23,6 +23,8 @@ MODERATOR_ROLE = 267629731250176001
DEVOPS_ROLE = 409416496733880320
HELPER_ROLE = 267630620367257601
+ALL_STAFF_ROLES = (OWNER_ROLE, ADMIN_ROLE, MODERATOR_ROLE, DEVOPS_ROLE)
+
SERVER_ID = 267624335836053506
DISCORD_API_ENDPOINT = "https://discordapp.com/api"
diff --git a/pysite/route_manager.py b/pysite/route_manager.py
index fb032470..f8a7515e 100644
--- a/pysite/route_manager.py
+++ b/pysite/route_manager.py
@@ -30,7 +30,7 @@ class RouteManager:
self.sockets = Sockets(self.app)
self.db = RethinkDB()
- self.log = logging.getLogger()
+ self.log = logging.getLogger(__name__)
self.app.secret_key = os.environ.get("WEBPAGE_SECRET_KEY", "super_secret")
self.app.config["SERVER_NAME"] = os.environ.get("SERVER_NAME", "pythondiscord.local:8080")
self.app.config["PREFERRED_URL_SCHEME"] = PREFERRED_URL_SCHEME
diff --git a/pysite/views/staff/index.py b/pysite/views/staff/index.py
index 683b3a77..2c93dd1a 100644
--- a/pysite/views/staff/index.py
+++ b/pysite/views/staff/index.py
@@ -1,10 +1,13 @@
# coding=utf-8
from pysite.base_route import RouteView
+from pysite.constants import ALL_STAFF_ROLES
+from pysite.decorators import require_roles
class StaffView(RouteView):
path = "/"
name = "staff.index"
+ @require_roles(*ALL_STAFF_ROLES)
def get(self):
return self.render("staff/staff.html")