summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py33
1 files changed, 2 insertions, 31 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 94b630a8f7..75c5911036 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -120,32 +120,6 @@ def objtojson(obj):
120 raise TypeError("Unserializable object %s (%s) of type %s" % ( obj, dir(obj), type(obj))) 120 raise TypeError("Unserializable object %s (%s) of type %s" % ( obj, dir(obj), type(obj)))
121 121
122 122
123def _template_renderer(template):
124 def func_wrapper(view):
125 def returned_wrapper(request, *args, **kwargs):
126 try:
127 context = view(request, *args, **kwargs)
128 except RedirectException as e:
129 return e.get_redirect_response()
130
131 if request.GET.get('format', None) == 'json':
132 # objects is a special keyword - it's a Page, but we need the actual objects here
133 # in XHR, the objects come in the "rows" property
134 if "objects" in context:
135 context["rows"] = context["objects"].object_list
136 del context["objects"]
137
138 # we're about to return; to keep up with the XHR API, we set the error to OK
139 context["error"] = "ok"
140
141 return HttpResponse(jsonfilter(context, default=objtojson ),
142 content_type = "application/json; charset=utf-8")
143 else:
144 return render(request, template, context)
145 return returned_wrapper
146 return func_wrapper
147
148
149def _lv_to_dict(prj, x = None): 123def _lv_to_dict(prj, x = None):
150 if x is None: 124 if x is None:
151 def wrapper(x): 125 def wrapper(x):
@@ -1528,8 +1502,6 @@ if True:
1528 } 1502 }
1529 return render(request, template, context) 1503 return render(request, template, context)
1530 1504
1531 # TODO merge with api pseudo api here is used for deps modal
1532 @_template_renderer('layerdetails.html')
1533 def layerdetails(request, pid, layerid): 1505 def layerdetails(request, pid, layerid):
1534 project = Project.objects.get(pk=pid) 1506 project = Project.objects.get(pk=pid)
1535 layer_version = Layer_Version.objects.get(pk=layerid) 1507 layer_version = Layer_Version.objects.get(pk=layerid)
@@ -1557,7 +1529,7 @@ if True:
1557 'projectlayers': list(project_layers) 1529 'projectlayers': list(project_layers)
1558 } 1530 }
1559 1531
1560 return context 1532 return render(request, 'layerdetails.html', context)
1561 1533
1562 1534
1563 def get_project_configvars_context(): 1535 def get_project_configvars_context():
@@ -1577,7 +1549,6 @@ if True:
1577 1549
1578 return(vars_managed,sorted(vars_fstypes),vars_blacklist) 1550 return(vars_managed,sorted(vars_fstypes),vars_blacklist)
1579 1551
1580 @_template_renderer("projectconf.html")
1581 def projectconf(request, pid): 1552 def projectconf(request, pid):
1582 1553
1583 try: 1554 try:
@@ -1648,7 +1619,7 @@ if True:
1648 except (ProjectVariable.DoesNotExist, BuildEnvironment.DoesNotExist): 1619 except (ProjectVariable.DoesNotExist, BuildEnvironment.DoesNotExist):
1649 pass 1620 pass
1650 1621
1651 return context 1622 return render(request, "projectconf.html", context)
1652 1623
1653 def _file_names_for_artifact(build, artifact_type, artifact_id): 1624 def _file_names_for_artifact(build, artifact_type, artifact_id):
1654 """ 1625 """