Skip to content

Conversation

@alesdotio
Copy link

I use {% experiments_confirm_human %} in my base.html template, which is also used for Django error pages. This causes the web process to die with an ugly 500 page instead of the pretty Django one when an error occurs.

Example traceback:

File "..../site-packages/experiments/templatetags/experiments.py", line 23, in experiments_confirm_human
return {'confirmed_human': request.session.get(conf.CONFIRM_HUMAN_SESSION_KEY, False)}
AttributeError: 'NoneType' object has no attribute 'session'

The template tag should probably not be used on error pages in the first place, but we can prevent it from failing by checking if the request is None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant