This is a tornado template (say, in the file logout.html) I render on an error in the logout process:
{% if logout_error %}
Oops! The logout failed. Please close all open documents and try again
{% end %}
This can be called using
self.render("logout.html", logout_error=True)
If the logout is successful, I have to do
self.render("logout.html", logout_error=False)
If I ignore logout_error=False
, I get
NameError: global name 'logout_error' is not defined
If there are a lot of flags (which are false), the keyword arguments can pile up. Is there a way I can ask the template to consider logout_error
as False
if it does not exist?