From 14ba418d4eb56d4a512392c04bdc384394b572f8 Mon Sep 17 00:00:00 2001 From: Ales Kocjancic Date: Tue, 17 Apr 2018 10:37:39 +0200 Subject: [PATCH] fixed exception in experiments_confirm_human when no request is set --- experiments/templatetags/experiments.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/experiments/templatetags/experiments.py b/experiments/templatetags/experiments.py index c8fa1934..36cbade3 100644 --- a/experiments/templatetags/experiments.py +++ b/experiments/templatetags/experiments.py @@ -20,7 +20,8 @@ def experiment_goal(goal_name): @register.inclusion_tag('experiments/confirm_human.html', takes_context=True) def experiments_confirm_human(context): request = context.get('request') - return {'confirmed_human': request.session.get(conf.CONFIRM_HUMAN_SESSION_KEY, False)} + if request: + return {'confirmed_human': request.session.get(conf.CONFIRM_HUMAN_SESSION_KEY, False)} class ExperimentNode(template.Node):