It's a DNF bug, but the Yum code is broken too, it's just
harder to trigger this. Patch fixes the following:
- Exception.__init__() should be called.
- 'errors' should not be printed when handling the exception,
as the raising site did this already. There's just one user
in doTransaction().
- 'msg' should be printed instead.
- __str__() and __unicode__() overrides are void when using
e.value directly, should be dropped.
reproducer:
>>> e = yum.Errors.YumRPMTransError('Foo', [])
>>> yum.i18n.exception2msg(e.value)
u'[]' # bad
u'Foo' # good
---
yum/Errors.py | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/yum/Errors.py b/yum/Errors.py
index 70de539..bbe9938 100644
--- a/yum/Errors.py
+++ b/yum/Errors.py
@@ -51,17 +51,8 @@ class YumRPMTransError(YumBaseError):
with YumBaseError in that we print nicely, and compat. with traditional
usage of this error from runTransaction(). """
def __init__(self, msg, errors):
- self.msg = msg
+ YumBaseError.__init__(self, msg)
self.errors = errors
- # old YumBaseError raises from runTransaction used to raise just this
- self.value = self.errors
-
- def __str__(self):
- return "%s" %(self.msg,)
-
- def __unicode__(self):
- return '%s' % to_unicode(self.msg)
-
class LockError(YumBaseError):
def __init__(self, errno, msg, pid=0):
--
1.7.11.7
_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel