Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id C6304E00D8B; Fri, 9 Dec 2016 08:30:22 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no * trust * [74.125.82.46 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 9088DE00C40 for ; Fri, 9 Dec 2016 08:30:02 -0800 (PST) Received: by mail-wm0-f46.google.com with SMTP id f82so32002170wmf.1 for ; Fri, 09 Dec 2016 08:30:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=s4fthbC6G2uhyxEKlWcQ3DwQmlcXu5wNCEOer65vhek=; b=AM+gpIKkjyXkZDtWSByI2e5/LQNvKxQNUgHKpY/2RATagG6rXUpPhh8GQFCwPsIZzy b+6Ig7CsUW1QvRAkXQLXP3qHYqGdfooMUkvtrb1JJ2Md7pNKnUAllltQXm5fXw8tczIi BHv7FEgBJNgkaGQNi+/N6k6jbEVToyIxs1Hrmp3YQOvxlQdUs/JBEK/Yqw347g+gplaE G5DS/C6LuEaapyzjvSZYqSJUZWizkNmzDdWuQu0ey7zZFABAFGgUZAAyEeBXLqjYojhd ScOB1W1FHhoJTXME7fmFRdVQYJ0HNi8/H1sXAfspMwTSf8HcnygxzEm/oqJsZQ6C2s1e LYLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=s4fthbC6G2uhyxEKlWcQ3DwQmlcXu5wNCEOer65vhek=; b=EioXG7Z+cDd7s8afJVIVw9vGUGNVmD4RWWybpLObYlofh5JSSJOhu0r0MPyH+mOkMp blCJarePVIjsS4z5EkZ5d+hnfYrpcsHzYb/wc1GTWDFcDPGevsizaGXBRoyXaMEczb8V LkXoLiVunhRNAaFaXOvBjNjEuV2FADgBiEjAZqYz1pZwcuHOlZHwM36k+l58bzGGhyLi WsHUAmcIt/S1P0MGLAqkDwEIeg4wiUt9LtmvKKV9/GnzuXThkc/WPkwlWV0r17NOkqWV m+o84PBhPw5pdJb08Wckwt/V2JUNGk0ThT4L0+CCafCrAgYbEXnR8wbx+J/uXm3xGZRp RqWg== X-Gm-Message-State: AKaTC03ZSyBoQ+CBNZzh/oO2R8xKYwy2aeYDkOVuN/GG769oLkGvwY7sDFvChQL/VxPrTt8P X-Received: by 10.28.147.81 with SMTP id v78mr7935695wmd.60.1481301001596; Fri, 09 Dec 2016 08:30:01 -0800 (PST) Received: from localhost.localdomain ([192.198.151.62]) by smtp.gmail.com with ESMTPSA id x5sm43051348wje.36.2016.12.09.08.30.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Dec 2016 08:30:00 -0800 (PST) From: Michael Wood To: toaster@yoctoproject.org Date: Fri, 9 Dec 2016 16:29:45 +0000 Message-Id: <1481300985-7356-15-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481300985-7356-1-git-send-email-michael.g.wood@intel.com> References: <1481300985-7356-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 14/14] toaster: views Remove old code that converts template context to JSON X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2016 16:30:22 -0000 Remove the template context to JSON decorator function as this is deprecated by having a proper REST API. Signed-off-by: Michael Wood --- bitbake/lib/toaster/toastergui/views.py | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 94b630a..75c5911 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -120,32 +120,6 @@ def objtojson(obj): raise TypeError("Unserializable object %s (%s) of type %s" % ( obj, dir(obj), type(obj))) -def _template_renderer(template): - def func_wrapper(view): - def returned_wrapper(request, *args, **kwargs): - try: - context = view(request, *args, **kwargs) - except RedirectException as e: - return e.get_redirect_response() - - if request.GET.get('format', None) == 'json': - # objects is a special keyword - it's a Page, but we need the actual objects here - # in XHR, the objects come in the "rows" property - if "objects" in context: - context["rows"] = context["objects"].object_list - del context["objects"] - - # we're about to return; to keep up with the XHR API, we set the error to OK - context["error"] = "ok" - - return HttpResponse(jsonfilter(context, default=objtojson ), - content_type = "application/json; charset=utf-8") - else: - return render(request, template, context) - return returned_wrapper - return func_wrapper - - def _lv_to_dict(prj, x = None): if x is None: def wrapper(x): @@ -1528,8 +1502,6 @@ if True: } return render(request, template, context) - # TODO merge with api pseudo api here is used for deps modal - @_template_renderer('layerdetails.html') def layerdetails(request, pid, layerid): project = Project.objects.get(pk=pid) layer_version = Layer_Version.objects.get(pk=layerid) @@ -1557,7 +1529,7 @@ if True: 'projectlayers': list(project_layers) } - return context + return render(request, 'layerdetails.html', context) def get_project_configvars_context(): @@ -1577,7 +1549,6 @@ if True: return(vars_managed,sorted(vars_fstypes),vars_blacklist) - @_template_renderer("projectconf.html") def projectconf(request, pid): try: @@ -1648,7 +1619,7 @@ if True: except (ProjectVariable.DoesNotExist, BuildEnvironment.DoesNotExist): pass - return context + return render(request, "projectconf.html", context) def _file_names_for_artifact(build, artifact_type, artifact_id): """ -- 2.7.4