Skip to contentSkip to conversation

parser: Add Unicode support to the error log

PATCH In review [email protected] 2 participants 2 messages Sep 30, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 parser: Add Unicode support to the error log

From: Mariano Lopez <[email protected]>

If the server receives a error log with Unicode character in it, it will throw and internal server error, this is caused because the server doesn't try to convert everything to ASCII

This patch changes the log encoding to UTF-8 so it will allow Unicode characters.

[YOCTO #8225]

---
 Post/parser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Post/parser.py +1 -1
index d33a968..599afde 100644
@@ -85,7 +85,7 @@ class Parser:
                 recipe = package
                 recipe_version = "unknown"
 
-            f = BuildFailure(TASK = str(fail['task']), RECIPE = recipe, RECIPE_VERSION = recipe_version, ERROR_DETAILS = str(fail['log']), BUILD = b)
+            f = BuildFailure(TASK = str(fail['task']), RECIPE = recipe, RECIPE_VERSION = recipe_version, ERROR_DETAILS = fail['log'].encode('utf-8'), BUILD = b)
 
             f.save()
 
Signature · 1 line
1.9.1
#1 lore raw
Quoted 22 lines · On 30/09/15 14:54, [email protected] wrote:

From: Mariano Lopez <[email protected]>

If the server receives a error log with Unicode character in it, it will throw and internal server error, this is caused because the server doesn't try to convert everything to ASCII

This patch changes the log encoding to UTF-8 so it will allow Unicode characters.

[YOCTO #8225]

---
  Post/parser.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Post/parser.py +0 -0
index d33a968..599afde 100644

Post/parser.py class Parser: · line 91

Quoted 8 lines
Post/parser.py +1 -1
@@ -85,7 +85,7 @@ class Parser:
                  recipe = package
                  recipe_version = "unknown"
 
-            f = BuildFailure(TASK = str(fail['task']), RECIPE = recipe, RECIPE_VERSION = recipe_version, ERROR_DETAILS = str(fail['log']), BUILD = b)
+            f = BuildFailure(TASK = str(fail['task']), RECIPE = recipe, RECIPE_VERSION = recipe_version, ERROR_DETAILS = fail['log'].encode('utf-8'), BUILD = b)
 
              f.save()
 

Thanks for the patch. Now committed.

Michael