On Tue, 2011-08-09 at 05:35 -0400, Zdenek Pavlas wrote: > >> except yum.Errors.YumBaseError, e: > >> - return 1, [str(e)] > >> + return 1, [to_utf8(e)] > > > This can't be "right", although I wouldn't be shocked to find out the > > original is "wrong" in some cases. > > str(e) is certainly wrong. It calls __str__() method which returns > 'e.value', possibly a unicode string. str() then tries to convert > it to <type 'str'> with ascii codec, triggering an exception.
Yeh. > to_utf8(e) is wrong, too. It does nothing (returns e), but the logging > module later does unicode(e), and that's fine. Yeh. > > At a guess it should probably be [exception2msg(e)], might as well put > > that in a different patch though. > > exception2msg() is in utils.py, and cli.py can't import that module > without major code re-shuffling because it extends class YumBaseCli > which is in the middle of cli.py Ok, so we can move it about. Probably i18n.py or at worst misc.py. > But, all what exception2msg() really does is 'to_unicode(e.value)', > and YumBaseError.__unicode__() implements exactly the same thing. > So, I suggest using [unicode(e)] instead. Is that ok? The problem is that unicode(e) has problems on RHEL-5 python, IIRC. _______________________________________________ Yum-devel mailing list [email protected] http://lists.baseurl.org/mailman/listinfo/yum-devel
