[oe-commits] [bitbake] 06/07: toaster: use force_bytes to display non-ascii project names

git at git.openembedded.org git at git.openembedded.org
Wed Mar 9 22:46:18 UTC 2016


rpurdie pushed a commit to branch master
in repository bitbake.

commit b6141c4d170885d3bdf63074afcb1e41fde0a8f0
Author: Sujith H <sujith.h at gmail.com>
AuthorDate: Tue Mar 8 18:09:02 2016 +0000

    toaster: use force_bytes to display non-ascii project names
    
    When user enters a non-ascii character in the project
    name of toaster, the build doesn't get triggered.
    Use force_bytes to fix this.
    
    Also deal with non-ascii project names when logging the
    build request in runbuilds.
    
    [YOCTO #9071]
    
    Signed-off-by: Sujith H <sujith.h at gmail.com>
    Signed-off-by: Elliot Smith <elliot.smith at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/toaster/bldcontrol/management/commands/runbuilds.py | 2 +-
 lib/toaster/bldcontrol/models.py                        | 4 +++-
 lib/toaster/orm/models.py                               | 5 ++++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/toaster/bldcontrol/management/commands/runbuilds.py b/lib/toaster/bldcontrol/management/commands/runbuilds.py
index edf71a7..0bd5d08 100644
--- a/lib/toaster/bldcontrol/management/commands/runbuilds.py
+++ b/lib/toaster/bldcontrol/management/commands/runbuilds.py
@@ -47,7 +47,7 @@ class Command(NoArgsCommand):
                 logger.debug("runbuilds: No build env")
                 return
 
-            logger.debug("runbuilds: starting build %s, environment %s" % (br, bec.be))
+            logger.debug("runbuilds: starting build %s, environment %s" % (str(br).decode('utf-8'), bec.be))
 
             # write the build identification variable
             BRVariable.objects.create(req = br, name="TOASTER_BRBE", value="%d:%d" % (br.pk, bec.be.pk))
diff --git a/lib/toaster/bldcontrol/models.py b/lib/toaster/bldcontrol/models.py
index 9244ed1..9b2d0d0 100644
--- a/lib/toaster/bldcontrol/models.py
+++ b/lib/toaster/bldcontrol/models.py
@@ -1,5 +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 orm.models import Project, ProjectLayer, ProjectVariable, ProjectTarget, Build, Layer_Version
 
 # a BuildEnvironment is the equivalent of the "build/" directory on the localhost
@@ -94,7 +96,7 @@ class BuildRequest(models.Model):
         return self.brvariable_set.get(name="MACHINE").value
 
     def __str__(self):
-        return "%s %s" % (self.project, self.get_state_display())
+        return force_bytes('%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*
diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index 93b5df3..f9c4fb0 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -19,9 +19,12 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
+from __future__ import unicode_literals
+
 from django.db import models, IntegrityError
 from django.db.models import F, Q, Avg, Max, Sum
 from django.utils import timezone
+from django.utils.encoding import force_bytes
 
 from django.core.urlresolvers import reverse
 
@@ -1614,7 +1617,7 @@ class LogMessage(models.Model):
     lineno = models.IntegerField(null=True)
 
     def __str__(self):
-        return "%s %s %s" % (self.get_level_display(), self.message, self.build)
+        return force_bytes('%s %s %s' % (self.get_level_display(), self.message, self.build))
 
 def invalidate_cache(**kwargs):
     from django.core.cache import cache

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


More information about the Openembedded-commits mailing list