From 355e1f4fc70d817751d9555de5d934538555212f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 31 Aug 2015 21:55:31 +0200 Subject: [PATCH] Do env variable handling outside of template. --- httpbin/core.py | 4 ++-- httpbin/templates/index.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/httpbin/core.py b/httpbin/core.py index 1c85e81..18d249d 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -92,8 +92,8 @@ def set_cors_headers(response): @app.route('/') def view_landing_page(): """Generates Landing Page.""" - - return render_template('index.html', env=os.environ) + tracking_enabled = 'HTTPBIN_TRACKING' in os.environ + return render_template('index.html', tracking_enabled=tracking_enabled) @app.route('/html') diff --git a/httpbin/templates/index.html b/httpbin/templates/index.html index f63c749..6ac81f0 100644 --- a/httpbin/templates/index.html +++ b/httpbin/templates/index.html @@ -56,7 +56,7 @@ {% include 'httpbin.1.html' %} -{% if env.get('HTTPBIN_TRACKING', '0') == '1' %} +{% if tracking_enabled %} {% include 'trackingscripts.html' %} {% endif %}