Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 1F436E00CE9; Fri, 9 Dec 2016 08:56:59 -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.48 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-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 4777FE00CBC for ; Fri, 9 Dec 2016 08:56:56 -0800 (PST) Received: by mail-wm0-f48.google.com with SMTP id f82so32670986wmf.1 for ; Fri, 09 Dec 2016 08:56:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=8BejeprPPvSmIA3L7dTD6/4yu33spFSp0Q6L7wX/7bE=; b=UaN/IlQA0Zvd+Pxsn3aPQv5xPeRse9zOcS08t/Kz4udJxEXtrv8UAdT/QLFNZlDOpj 2C3fQFSeamhZMZYwrDzQEbUBTYfyNrckQFcc7mS560ZPgkz5KiOT845+lohbq/ee+1I7 XXo+jpYmgVZ8UQaO33WW6j4pPcdsvo+RLSDTfPcSGZyVJ52kVn7hxrBoCrm0R2ohC5iy WJObSwDjHQ63/+bH2rwbZ0jAtR2pjAkaXxDZEYKrILFd9/8EJpaZUwrLRgpAVI+sXdik afbaBzWKY7lioiQeMQeTZWAEESi3v7Je3nNB9aEynfgm4xhw+t/GRwU+5dVXOOSRImLP ZbaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=8BejeprPPvSmIA3L7dTD6/4yu33spFSp0Q6L7wX/7bE=; b=LqXh26WKJEP2gia2xWGOb81dfhSkUGZL94k6CJbPuyXb/28VPEV/1SEzVXDxWLIzUs XTFAXlip/kc4qgPIn2GVc0vDEj1BxTqrYwvzpdubSuuQ0BHR36n9/XAo/P8xjddYVT0p hURnHloFs/X1WhNc1IXSiqFmmGRMjJ+g/PUl1ustpIaFXjU/fRGDbbZlCRgt4v0ldT0Z QVQin/v01qZGY5Tf/QcIQ2fI3Xc4bnTUvt2mYFB8i8ze8QExV7Lhxt8hXt1FK6y70/HS 03E0d0B8f1xK3f4bK7b4Xfu+jUfxN/OmL5QgriJKsig7QuHGBdP0E9DCiwDv7tlJuDO8 4ztw== X-Gm-Message-State: AKaTC03xZI+3zODdKfjDQ+byZUsqAiYMt0nJnjn6Zd8g9E1nJyW+yKfgZPoRm+Uf3SiMo/AG X-Received: by 10.28.168.137 with SMTP id r131mr7401645wme.16.1481302615768; Fri, 09 Dec 2016 08:56:55 -0800 (PST) Received: from [10.169.141.143] ([192.198.151.62]) by smtp.googlemail.com with ESMTPSA id l6sm21464273wmd.5.2016.12.09.08.56.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Dec 2016 08:56:55 -0800 (PST) To: "toaster@yoctoproject.org" References: <1481300985-7356-1-git-send-email-michael.g.wood@intel.com> <1481300985-7356-15-git-send-email-michael.g.wood@intel.com> From: Michael Wood Message-ID: Date: Fri, 9 Dec 2016 16:56:53 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1481300985-7356-15-git-send-email-michael.g.wood@intel.com> Subject: Re: [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:56:59 -0000 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Testing completed: https://patchwork.openembedded.org/series/4325/ https://travis-ci.org/toastertester/toaster-next/builds/182640258 I've submitted this series to bitbake upstream see thread " [PATCH 00/14] Patches for Toaster 09.12.16​" Michael On 09/12/16 16:29, Michael Wood wrote: > 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): > """