summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/widgets.py
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2015-10-05 12:08:32 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-11 05:33:02 +0100
commitb661f535e6a7d33b1dfcb1068e8cff14e897d005 (patch)
treeb1c8dcfd007163c2819f5f794738fe4e1d681a92 /bitbake/lib/toaster/toastergui/widgets.py
parenta3742a0f68cc10cadcea659b945f526293adb994 (diff)
downloadpoky-b661f535e6a7d33b1dfcb1068e8cff14e897d005.tar.gz
bitbake: toaster: Don't HTTP cache ToasterTable responses
Django allows generated pages to be cached by default by the browser. This can result in stale data displaying for some pages. Instead, disable HTTP caching of ToasterTable responses, so that each time a ToasterTable view is displayed, its data is refreshed. This carries a performance penalty, but ensures that ToasterTable views (e.g. compatible layers) are correctly refreshed if the user navigates their history with forward/back. [YOCTO #7660] (Bitbake rev: 44dccd3018554915868d6c8fe5e22624a2fcdec5) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/widgets.py')
-rw-r--r--bitbake/lib/toaster/toastergui/widgets.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/widgets.py b/bitbake/lib/toaster/toastergui/widgets.py
index e58dd7c236..6bb388936c 100644
--- a/bitbake/lib/toaster/toastergui/widgets.py
+++ b/bitbake/lib/toaster/toastergui/widgets.py
@@ -20,6 +20,7 @@
20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 21
22from django.views.generic import View, TemplateView 22from django.views.generic import View, TemplateView
23from django.views.decorators.cache import cache_control
23from django.shortcuts import HttpResponse 24from django.shortcuts import HttpResponse
24from django.http import HttpResponseBadRequest 25from django.http import HttpResponseBadRequest
25from django.core import serializers 26from django.core import serializers
@@ -64,6 +65,11 @@ class ToasterTable(TemplateView):
64 orderable=True, 65 orderable=True,
65 field_name="id") 66 field_name="id")
66 67
68 # prevent HTTP caching of table data
69 @cache_control(must_revalidate=True, max_age=0, no_store=True, no_cache=True)
70 def dispatch(self, *args, **kwargs):
71 return super(ToasterTable, self).dispatch(*args, **kwargs)
72
67 def get_context_data(self, **kwargs): 73 def get_context_data(self, **kwargs):
68 context = super(ToasterTable, self).get_context_data(**kwargs) 74 context = super(ToasterTable, self).get_context_data(**kwargs)
69 context['title'] = self.title 75 context['title'] = self.title