Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 3A4D0E00BFD; Fri, 16 Oct 2015 07:33:14 -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 44129E00BC1 for ; Fri, 16 Oct 2015 07:33:10 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 16 Oct 2015 07:33:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,689,1437462000"; d="scan'208";a="582183065" Received: from bbryczek-mobl.ger.corp.intel.com (HELO lp.ger.corp.intel.com) ([10.252.3.107]) by FMSMGA003.fm.intel.com with ESMTP; 16 Oct 2015 07:33:07 -0700 From: Elliot Smith To: toaster@yoctoproject.org Date: Fri, 16 Oct 2015 15:32:52 +0100 Message-Id: <1445005977-14892-2-git-send-email-elliot.smith@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1445005977-14892-1-git-send-email-elliot.smith@intel.com> References: <1445005977-14892-1-git-send-email-elliot.smith@intel.com> Subject: [review-request][PATCH 1/6] toaster: Add BUILD_MODE flag to context 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: Fri, 16 Oct 2015 14:33:14 -0000 We set a TOASTER_MANAGED env variable in the startup script, which has a value of "1" if Toaster should run in build mode. Add a BUILD_MODE variable to settings.py which is True if TOASTER_MANAGED is set to "1", False otherwise. Add this to the context for every template, so we can use this information to conditionally alter the content of pages according to the mode we're in. [YOCTO #8514] Signed-off-by: Elliot Smith --- bitbake/lib/toaster/toastergui/views.py | 4 ++++ bitbake/lib/toaster/toastermain/settings.py | 6 ++---- bitbake/lib/toaster/toastermain/urls.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index e2f2874..10bbef5 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -1880,6 +1880,10 @@ def managedcontextprocessor(request): "projects": projects, "non_cli_projects": projects.exclude(is_default=True), "DEBUG" : toastermain.settings.DEBUG, + + # True if Toaster is in build mode, False otherwise + "BUILD_MODE": toastermain.settings.BUILD_MODE, + "CUSTOM_IMAGE" : toastermain.settings.CUSTOM_IMAGE, "TOASTER_BRANCH": toastermain.settings.TOASTER_BRANCH, "TOASTER_REVISION" : toastermain.settings.TOASTER_REVISION, diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index 6439d68..b28ddb2 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py @@ -92,11 +92,9 @@ if 'DATABASE_URL' in os.environ: else: raise Exception("FIXME: Please implement missing database url schema for url: %s" % dburl) - +BUILD_MODE = False if 'TOASTER_MANAGED' in os.environ and os.environ['TOASTER_MANAGED'] == "1": - MANAGED = True -else: - MANAGED = False + BUILD_MODE = True # Allows current database settings to be exported as a DATABASE_URL environment variable value diff --git a/bitbake/lib/toaster/toastermain/urls.py b/bitbake/lib/toaster/toastermain/urls.py index 521588a..6c4a953 100644 --- a/bitbake/lib/toaster/toastermain/urls.py +++ b/bitbake/lib/toaster/toastermain/urls.py @@ -60,7 +60,7 @@ if toastermain.settings.DEBUG_PANEL_ENABLED: #logger.info("Enabled django_toolbar extension") -if toastermain.settings.MANAGED: +if toastermain.settings.BUILD_MODE: urlpatterns = [ # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), -- 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.