[oe-commits] [bitbake] 10/23: toaster: use force_text instead of force_bytes

git at git.openembedded.org git at git.openembedded.org
Tue May 17 22:25:20 UTC 2016


rpurdie pushed a commit to branch python3
in repository bitbake.

commit 8b7f9b423605adf2274cf1d2ab190595c36ef8cb
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Tue May 10 11:04:49 2016 +0300

    toaster: use force_text instead of force_bytes
    
    Usage of force_bytes in BuildRequest.__str__ method caused
    python 3 to throw "__str__ returned non-string (type bytes)"
    error.
    
    Replaced force_bytes with force_text to make the code working
    on 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/bldcontrol/management/commands/runbuilds.py | 4 ++--
 lib/toaster/bldcontrol/models.py                        | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/toaster/bldcontrol/management/commands/runbuilds.py b/lib/toaster/bldcontrol/management/commands/runbuilds.py
index 5532b9d..b630fe6 100644
--- a/lib/toaster/bldcontrol/management/commands/runbuilds.py
+++ b/lib/toaster/bldcontrol/management/commands/runbuilds.py
@@ -54,8 +54,8 @@ class Command(NoArgsCommand):
                 logger.debug("runbuilds: No build env")
                 return
 
-            logger.debug("runbuilds: starting build %s, environment %s" % \
-                         (str(br).decode('utf-8'), bec.be))
+            logger.info("runbuilds: starting build %s, environment %s" % \
+                        (br, bec.be))
 
             # let the build request know where it is being executed
             br.environment = bec.be
diff --git a/lib/toaster/bldcontrol/models.py b/lib/toaster/bldcontrol/models.py
index e09ad20..f06c562 100644
--- a/lib/toaster/bldcontrol/models.py
+++ b/lib/toaster/bldcontrol/models.py
@@ -1,7 +1,7 @@
 from __future__ import unicode_literals
 from django.db import models
 from django.core.validators import MaxValueValidator, MinValueValidator
-from django.utils.encoding import force_bytes
+from django.utils.encoding import force_text
 from orm.models import Project, ProjectLayer, ProjectVariable, ProjectTarget, Build, Layer_Version
 
 import logging
@@ -121,7 +121,7 @@ class BuildRequest(models.Model):
         return self.brvariable_set.get(name="MACHINE").value
 
     def __str__(self):
-        return force_bytes('%s %s' % (self.project, self.get_state_display()))
+        return force_text('%s %s' % (self.project, self.get_state_display()))
 
 # These tables specify the settings for running an actual build.
 # They MUST be kept in sync with the tables in orm.models.Project*

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list