from toastergui.templatetags.projecttags import json as jsonfilter
import json
from os.path import dirname
+from functools import wraps
import itertools
import magic
return context
+ def xhr_response(fun):
+ """
+ Decorator for REST methods.
+ calls jsonfilter on the returned dictionary and returns result
+ as HttpResponse object of content_type application/json
+ """
+ @wraps(fun)
+ def wrapper(*args, **kwds):
+ return HttpResponse(jsonfilter(fun(*args, **kwds)),
+ content_type="application/json")
+ return wrapper
+
def jsunittests(request):
""" Provides a page for the js unit tests """
bbv = BitbakeVersion.objects.filter(branch="master").first()