Check for globals in calc_users; fix error pages.

master
Snakes 2022-10-15 07:23:29 -04:00
parent c428a59397
commit c95e33831c
Signed by: Snakes
GPG Key ID: E745A82778055C7E
1 changed files with 4 additions and 0 deletions

View File

@ -9,6 +9,10 @@ import user_agents
import time
def calc_users(v):
# Some globals we expect aren't available when rendering error pages
if not g.agent or not ('session_id' in session):
return ''
loggedin = cache.get(f'{SITE}_loggedin') or {}
loggedout = cache.get(f'{SITE}_loggedout') or {}
timestamp = int(time.time())