From 910fabe1038736f752345829ee7a31f43b5252f4 Mon Sep 17 00:00:00 2001 From: jakedt Date: Wed, 26 Mar 2014 18:36:59 -0400 Subject: [PATCH 1/9] Disable that pesky browser cache in the ways that matter. --- endpoints/common.py | 9 ++++++++- templates/base.html | 10 +++++----- util/cache.py | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/endpoints/common.py b/endpoints/common.py index 4832aaaf0..4a8c03eb9 100644 --- a/endpoints/common.py +++ b/endpoints/common.py @@ -1,10 +1,12 @@ import logging import urlparse import json +import string from flask import make_response, render_template, request from flask.ext.login import login_user, UserMixin from flask.ext.principal import identity_changed +from random import SystemRandom from data import model from data.queue import dockerfile_build_queue @@ -83,8 +85,13 @@ def handle_dme(ex): return make_response(json.dumps({'message': ex.message}), 400) +def random_string(): + random = SystemRandom() + return ''.join([random.choice(string.ascii_uppercase + string.digits) for _ in range(8)]) + def render_page_template(name, **kwargs): - resp = make_response(render_template(name, route_data=json.dumps(get_route_data()), **kwargs)) + resp = make_response(render_template(name, route_data=json.dumps(get_route_data()), + cache_buster=random_string(), **kwargs)) resp.headers['X-FRAME-OPTIONS'] = 'DENY' return resp diff --git a/templates/base.html b/templates/base.html index 9baba0e25..59e427da1 100644 --- a/templates/base.html +++ b/templates/base.html @@ -17,7 +17,7 @@ - + @@ -76,10 +76,10 @@ window.__token = '{{ csrf_token() }}'; - - - - + + + +