summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/toaster/toastergui/urls.py3
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py15
2 files changed, 17 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py
index c8c1c6a1fe..2164c4c8f7 100644
--- a/bitbake/lib/toaster/toastergui/urls.py
+++ b/bitbake/lib/toaster/toastergui/urls.py
@@ -140,6 +140,9 @@ urlpatterns = patterns('toastergui.views',
140 'customrecipe', 140 'customrecipe',
141 name="customrecipe"), 141 name="customrecipe"),
142 142
143 url(r'^project/(?P<pid>\d+)/customrecipe/(?P<recipe_id>\d+)/download$',
144 'customrecipe_download',
145 name="customrecipedownload"),
143 146
144 147
145 # typeahead api end points 148 # typeahead api end points
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 389457daf3..b58f916d8c 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -27,7 +27,7 @@ import operator,re
27 27
28from django.db.models import F, Q, Sum, Count, Max 28from django.db.models import F, Q, Sum, Count, Max
29from django.db import IntegrityError, Error 29from django.db import IntegrityError, Error
30from django.shortcuts import render, redirect 30from django.shortcuts import render, redirect, get_object_or_404
31from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, LogMessage, Variable 31from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, LogMessage, Variable
32from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File, Package_Dependency 32from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File, Package_Dependency
33from orm.models import Target_Installed_Package, Target_File, Target_Image_File, BuildArtifact 33from orm.models import Target_Installed_Package, Target_File, Target_Image_File, BuildArtifact
@@ -2462,6 +2462,19 @@ if True:
2462 else: 2462 else:
2463 return {"error": "Method %s is not supported" % request.method} 2463 return {"error": "Method %s is not supported" % request.method}
2464 2464
2465 def customrecipe_download(request, pid, recipe_id):
2466 recipe = get_object_or_404(CustomImageRecipe, pk=recipe_id)
2467
2468 file_data = recipe.generate_recipe_file_contents()
2469
2470 response = HttpResponse(file_data, content_type='text/plain')
2471 response['Content-Disposition'] = \
2472 'attachment; filename="%s_%s.bb"' % (recipe.name,
2473 recipe.version)
2474
2475 return response
2476
2477
2465 @xhr_response 2478 @xhr_response
2466 def xhr_customrecipe_packages(request, recipe_id, package_id): 2479 def xhr_customrecipe_packages(request, recipe_id, package_id):
2467 """ 2480 """