Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 5C1B1E00BE3; Tue, 8 Dec 2015 13:18:36 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.220.42 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id EAE86E00B30 for ; Tue, 8 Dec 2015 13:18:03 -0800 (PST) Received: by pacej9 with SMTP id ej9so17873759pac.2 for ; Tue, 08 Dec 2015 13:18:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PIc4WwiJts/K5peDzxSSmMU20OxGCMDvHyMpVLYIFns=; b=aP1zjI8fbFSnohpj+hG+h0SOs9e3QGNVWcUwRKmbUDnkA8reifQ37+YOu1p3H48xmG Lk9+2NX2VAtirsm9jE7MFYpIXY5oYkgTkEK3X9jyx4vB/VbXIozjhERdqo/jFqStJndO ZW/TVB+XB7LA2ZWnaGN2BPtFYWc5DQUrvFSnH7VeUxtkvckHWSrQSzj+6boHhsKaUBpw JBKgXocU79lvFlTY2nqUWVleFlAcmGpo+xlDJ8be4pgRPAG8Bx3JKBO9QNfCczj/ZCV7 gmxWrBFzipkUb2lfINRyDp/uXsgmVqrO14WXqocu6PAvM+OXdg9Hhi4/CEIqM7YEMhRo fjNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PIc4WwiJts/K5peDzxSSmMU20OxGCMDvHyMpVLYIFns=; b=mNOrTKFBDVB8neqGThIIMpRdQH60V58o7ByMY11ulJ94/bCT5pUWIa4XNZqnKmn2ZZ qeVQ9bPTBgA3wFmRexxNxIi6evlggLZ7HF1AAOuo6UKVQE6Ki3a6a7VKwU39LYSb8y+P zwdwo0OBQxtXWfqbrrw9rkisqW/d+lnyHjPenkANnKkdWgjZQvEOceqmVtDRzlUMV3H3 JvJ+6cZQqjDLQdg9fly/0yHlOTKNafM1Y3rt9WIcseYXByFsk20/hGNo7j5XkwvxX2sr qYkcMTkbNQRWCHJ3eyGf3QdisfWrtOOc4aigTbAI0ojiItCzS6LeMMCxLrCPToR2Gjak gj6Q== X-Gm-Message-State: ALoCoQnJkbQIExMdaFYpSF1HDpChDPLJjc2fAmuZNfxjIQajFXC0tKqCtT1pKaWh5w0VtQxH3lLnxnNscbkYBWmoPLxrPaoEYw== X-Received: by 10.66.150.37 with SMTP id uf5mr3079699pab.30.1449609483817; Tue, 08 Dec 2015 13:18:03 -0800 (PST) Received: from draco.ger.corp.intel.com ([192.55.54.40]) by smtp.gmail.com with ESMTPSA id v64sm6675766pfi.50.2015.12.08.13.18.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Dec 2015 13:18:02 -0800 (PST) From: Michael Wood To: toaster@yoctoproject.org Date: Tue, 8 Dec 2015 21:16:19 +0000 Message-Id: <1449609380-11073-34-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1449609380-11073-1-git-send-email-michael.g.wood@intel.com> References: <1449609380-11073-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 33/34] toaster: tables SelectPackagesTable rename recipe_id to custrecipeid 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: Tue, 08 Dec 2015 21:18:36 -0000 Rename the recipe_id to custrecipeid to avoid confusion about which type of object we're going to be accessing. This means that in the unit tests for tables we can pass a different kwargs for custom recipes vs normal recipes. Signed-off-by: Michael Wood --- bitbake/lib/toaster/toastergui/tables.py | 12 ++++++++---- bitbake/lib/toaster/toastergui/urls.py | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index 9476887..2b3684b 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py @@ -685,7 +685,8 @@ class SelectPackagesTable(PackagesTable): self.title = "Add | Remove packages" def setup_queryset(self, *args, **kwargs): - cust_recipe = CustomImageRecipe.objects.get(pk=kwargs['recipeid']) + self.cust_recipe =\ + CustomImageRecipe.objects.get(pk=kwargs['custrecipeid']) prj = Project.objects.get(pk = kwargs['pid']) current_packages = self.cust_recipe.get_all_packages() @@ -705,13 +706,16 @@ class SelectPackagesTable(PackagesTable): self.queryset = self.queryset.order_by('name') - self.static_context_extra['recipe_id'] = kwargs['recipeid'] + self.static_context_extra['recipe_id'] = kwargs['custrecipeid'] self.static_context_extra['current_packages'] = \ - cust_recipe.packages.values_list('pk', flat=True) + current_packages.values_list('pk', flat=True) def get_context_data(self, **kwargs): + # to reuse the Super class map the custrecipeid to the recipe_id + kwargs['recipe_id'] = kwargs['custrecipeid'] context = super(SelectPackagesTable, self).get_context_data(**kwargs) - custom_recipe = CustomImageRecipe.objects.get(pk=kwargs['recipe_id']) + custom_recipe = \ + CustomImageRecipe.objects.get(pk=kwargs['custrecipeid']) context['recipe'] = custom_recipe context['approx_pkg_size'] = \ diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py index 36e5c38..57baa4d 100644 --- a/bitbake/lib/toaster/toastergui/urls.py +++ b/bitbake/lib/toaster/toastergui/urls.py @@ -123,11 +123,11 @@ urlpatterns = patterns('toastergui.views', name=tables.LayerMachinesTable.__name__.lower()), - url(r'^project/(?P\d+)/customrecipe/(?P\d+)/selectpackages/$', + url(r'^project/(?P\d+)/customrecipe/(?P\d+)/selectpackages/$', tables.SelectPackagesTable.as_view(), name="recipeselectpackages"), - url(r'^project/(?P\d+)/customrecipe/(?P\d+)$', + url(r'^project/(?P\d+)/customrecipe/(?P\d+)$', tables.SelectPackagesTable.as_view(template_name="customrecipe.html"), name="customrecipe"), -- 2.1.4