]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: tables SelectPackagesTable rename recipe_id to custrecipeid
authorMichael Wood <michael.g.wood@intel.com>
Tue, 8 Dec 2015 19:52:42 +0000 (19:52 +0000)
committerMichael Wood <michael.g.wood@intel.com>
Mon, 8 Feb 2016 17:35:47 +0000 (17:35 +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 <michael.g.wood@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
lib/toaster/toastergui/tables.py
lib/toaster/toastergui/urls.py

index 48829351b4ae4ed1b66f0e58fd20d163e2c070c9..d80b90254afbf7ad4a03d66b158bf2f3d48fdc23 100644 (file)
@@ -728,7 +728,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()
@@ -747,13 +748,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'] = \
index 969a29b22895fa18fcf4eb1692491fbac92f6ed9..4feeebc14aa670e657dc2dfe506af89790fa916c 100644 (file)
@@ -129,11 +129,11 @@ urlpatterns = patterns('toastergui.views',
             name=tables.LayerMachinesTable.__name__.lower()),
 
 
-        url(r'^project/(?P<pid>\d+)/customrecipe/(?P<recipeid>\d+)/selectpackages/$',
+        url(r'^project/(?P<pid>\d+)/customrecipe/(?P<custrecipeid>\d+)/selectpackages/$',
             tables.SelectPackagesTable.as_view(), name="recipeselectpackages"),
 
 
-        url(r'^project/(?P<pid>\d+)/customrecipe/(?P<recipe_id>\d+)$',
+        url(r'^project/(?P<pid>\d+)/customrecipe/(?P<custrecipeid>\d+)$',
             tables.SelectPackagesTable.as_view(template_name="customrecipe.html"),
             name="customrecipe"),