[yum-commits] urlgrabber/grabber.py

zpavlas at osuosl.org zpavlas at osuosl.org
Thu Sep 27 10:49:33 UTC 2012


 urlgrabber/grabber.py |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit a05e8f7d82acc8251a7e2ae4f4282d744966c59d
Author: Zdeněk Pavlas <zpavlas at redhat.com>
Date:   Thu Sep 27 12:42:12 2012 +0200

    Avoid unicode, use byte strings.
    
    Keep the return value consistent.  Should upper layer want unicode,
    it'll use to_unicode() anyway.

diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
index a33e017..76c3cc9 100644
--- a/urlgrabber/grabber.py
+++ b/urlgrabber/grabber.py
@@ -625,7 +625,8 @@ def exception2msg(e):
     try:
         return str(e)
     except UnicodeEncodeError:
-        return unicode(e)
+        # always use byte strings
+        return unicode(e).encode('utf8')
 
 ########################################################################
 #                 END UTILITY FUNCTIONS


More information about the Yum-commits mailing list