Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 7B5E5E00D99; Mon, 14 Sep 2015 08:10:15 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [134.134.136.24 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 11CEDE00D52 for ; Mon, 14 Sep 2015 08:10:10 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 14 Sep 2015 08:09:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,529,1437462000"; d="scan'208";a="789126576" Received: from unknown (HELO lp.ger.corp.intel.com) ([10.252.1.96]) by fmsmga001.fm.intel.com with ESMTP; 14 Sep 2015 08:09:34 -0700 From: Elliot Smith To: toaster@yoctoproject.org Date: Mon, 14 Sep 2015 16:09:24 +0100 Message-Id: <1442243364-14257-3-git-send-email-elliot.smith@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1442243364-14257-1-git-send-email-elliot.smith@intel.com> References: <1442243364-14257-1-git-send-email-elliot.smith@intel.com> Subject: [review-request][PATCH 2/2] toaster: Don't HTTP cache ToasterTable responses X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 15:10:15 -0000 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] Signed-off-by: Elliot Smith --- bitbake/lib/toaster/toastergui/widgets.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bitbake/lib/toaster/toastergui/widgets.py b/bitbake/lib/toaster/toastergui/widgets.py index eb2914d..52ca6be 100644 --- a/bitbake/lib/toaster/toastergui/widgets.py +++ b/bitbake/lib/toaster/toastergui/widgets.py @@ -20,6 +20,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. from django.views.generic import View, TemplateView +from django.views.decorators.cache import cache_control from django.shortcuts import HttpResponse from django.http import HttpResponseBadRequest from django.core import serializers @@ -61,6 +62,10 @@ class ToasterTable(TemplateView): orderable=True, field_name="id") + # prevent HTTP caching of table data + @cache_control(must_revalidate=True, max_age=0, no_store=True, no_cache=True) + def dispatch(self, *args, **kwargs): + return super(ToasterTable, self).dispatch(*args, **kwargs) def get(self, request, *args, **kwargs): if request.GET.get('format', None) == 'json': -- Elliot Smith Software Engineer Intel OTC --------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.