# HG changeset patch # User Mads Kiilerich mads@kiilerich.com # Date 1267025085 -3600 # Node ID f54180cb4db5e6a06e95f2225b6f100aa68f6ee8 # Parent 710e272f26c41db3d3df22295e4b112477bed96d Use Exception.args instead of .message
Fixes python 2.6 deprecation warning
diff --git a/imgcreate/errors.py b/imgcreate/errors.py --- a/imgcreate/errors.py +++ b/imgcreate/errors.py @@ -23,8 +23,8 @@
# Some error messages may contain unicode strings (especially if your system # locale is different from 'C', e.g. 'de_DE'). Python's exception class does - # not handle this appropriately (at least until 2.5) because str(Exception) - # returns just self.message without ensuring that all characters can be + # not handle this appropriately (at least until 2.5) because str(Exception(x)) + # returns just x without ensuring that all characters can be # represented using ASCII. So we try to return a str and fall back to repr # if this does not work. # @@ -37,12 +37,12 @@ # first log call print a more readable error message. def __str__(self): try: - return str(self.message) + return str(self.args[0]) except UnicodeEncodeError: - return repr(self.message) + return repr(self.args[0])
def __unicode__(self): - return unicode(self.message) + return unicode(self.args[0])
class KickstartError(CreatorError): pass
livecd@lists.fedoraproject.org