Return-Path: Received: from dan.rpsys.net (5751f4a1.skybroadband.com [87.81.244.161]) by mail.openembedded.org (Postfix) with ESMTP id 6BB18773C0 for ; Wed, 1 Jun 2016 12:37:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by dan.rpsys.net (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id u51Cb3RT007477; Wed, 1 Jun 2016 13:37:03 +0100 Received: from dan.rpsys.net ([127.0.0.1]) by localhost (dan.rpsys.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id TqWgUz5mXw5w; Wed, 1 Jun 2016 13:37:03 +0100 (BST) Received: from hex ([192.168.3.34]) (authenticated bits=0) by dan.rpsys.net (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id u51CaxtD007460 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 1 Jun 2016 13:37:00 +0100 Received: from richard by hex with local (Exim 4.86) (envelope-from ) id 1b85ON-0000oj-F1; Wed, 01 Jun 2016 13:36:59 +0100 From: Richard Purdie To: bitbake-devel@lists.openembedded.org Date: Wed, 1 Jun 2016 13:36:37 +0100 Message-Id: <1464784607-2985-18-git-send-email-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1464784607-2985-1-git-send-email-richard.purdie@linuxfoundation.org> References: <1464784607-2985-1-git-send-email-richard.purdie@linuxfoundation.org> Subject: [PATCH 18/28] toaster: use re.sub() instead of translate() X-BeenThere: bitbake-devel@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussion that advance bitbake development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2016 12:37:11 -0000 From: Ed Bartosh translate has different set of parameters in python 3 and can't be used the way it's used in toaster api module. Replacing it with re.sub() should make the code work in both python 2 and python 3. [YOCTO #9584] Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- lib/toaster/toastergui/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/toaster/toastergui/api.py b/lib/toaster/toastergui/api.py index 42901f7..961b594 100644 --- a/lib/toaster/toastergui/api.py +++ b/lib/toaster/toastergui/api.py @@ -18,6 +18,7 @@ # Temporary home for the UI's misc API +import re from orm.models import Project, ProjectTarget, Build from bldcontrol.models import BuildRequest @@ -92,7 +93,7 @@ class XhrBuildRequest(View): if 'targets' in request.POST: ProjectTarget.objects.filter(project = project).delete() s = str(request.POST['targets']) - for t in s.translate(None, ";%|\"").split(" "): + for t in re.sub(r'[;%|"]', '', s).split(" "): if ":" in t: target, task = t.split(":") else: -- 2.5.0