summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 2e3b822797..95df60e472 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -45,6 +45,7 @@ from django.utils import formats
45from toastergui.templatetags.projecttags import json as jsonfilter 45from toastergui.templatetags.projecttags import json as jsonfilter
46import json 46import json
47from os.path import dirname 47from os.path import dirname
48from functools import wraps
48import itertools 49import itertools
49 50
50import magic 51import magic
@@ -2314,6 +2315,18 @@ if True:
2314 2315
2315 return context 2316 return context
2316 2317
2318 def xhr_response(fun):
2319 """
2320 Decorator for REST methods.
2321 calls jsonfilter on the returned dictionary and returns result
2322 as HttpResponse object of content_type application/json
2323 """
2324 @wraps(fun)
2325 def wrapper(*args, **kwds):
2326 return HttpResponse(jsonfilter(fun(*args, **kwds)),
2327 content_type="application/json")
2328 return wrapper
2329
2317 def jsunittests(request): 2330 def jsunittests(request):
2318 """ Provides a page for the js unit tests """ 2331 """ Provides a page for the js unit tests """
2319 bbv = BitbakeVersion.objects.filter(branch="master").first() 2332 bbv = BitbakeVersion.objects.filter(branch="master").first()