On Wed, 2011-01-12 at 10:14 -0800, Toshio Kuratomi wrote: > Note that there's a few places in this patch where you may start raising > a UnicodeException because before the code was either processing a str or > a unicode but your exception2msg() may return either a str or a unicode. > > A kitchen-based exception2msg (either using something like I sent in reply > to Seth or copy and pasting code) would always return unicode or always > return bytes depending on how it was written
Yeh, I think (with help) ... we should probably go this way for 3.2.30 and later, trying to get this "fixed" finally, by using kitchen and trying to track/merge all the string types everywhere. Of course this seems like it'll be a huge amount of pain. > On Wed, Jan 12, 2011 at 09:58:01AM -0500, James Antill wrote: > > try: > > self._getTs(needTsRemove) > > except yum.Errors.YumBaseError, e: > > - return 1, [str(e)] > > + return 1, [exception2msg(e)] > > The old code here would always return a byte str. The new code may return > unicode. If you get a unicode exception, it would probably be in code that > attempts to catch yum.Errors.YumBaseError. This isn't a re-raise, it's the return from doCommands() ... which is already a unicode/str mix, so we aren't screwing anything up anymore than it already is. And the caller already "handles" it, by going via. logging. > > except yum.Errors.ConfigError, e: > > - self.logger.critical(e) > > + self.logger.critical(exception2msg(e)) > > self.base.usage() > > sys.exit(1) > > > I'm not quite sure how the logger handles conversion between unicode and str > internally. One of python's few nice features of the logging module is that it catches all errors with the output and "just" eats the line (but that's almost always better than a traceback). _______________________________________________ Yum-devel mailing list Yum-devel@lists.baseurl.org http://lists.baseurl.org/mailman/listinfo/yum-devel