From 5582444b10418bef14ff274a2470a9050d7a7e17 Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Tue, 10 May 2016 17:06:54 +0300 Subject: bitbake: toaster: use re.sub() instead of translate() 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] (Bitbake rev: 019ac4792f388f3313812c1998492888be8b97cd) Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py index 42901f750a..961b594ef4 100644 --- a/bitbake/lib/toaster/toastergui/api.py +++ b/bitbake/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: -- cgit v1.2.3-54-g00ecf