[oe-commits] [bitbake] 18/23: toaster: use re.sub() instead of translate()
git at git.openembedded.org
git at git.openembedded.org
Sat May 21 11:18:19 UTC 2016
rpurdie pushed a commit to branch python3
in repository bitbake.
commit e22c88720eaf6e3d1dbfd5e8cf69a0f2ca0908a9
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Tue May 10 17:06:54 2016 +0300
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]
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
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:
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list