Rev 3741: Fix python-2.6 BaseException 'message' attribute deprecation. in file:///v/home/vila/src/bzr/experimental/bzr-py26-compat/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Fri Sep 26 15:45:23 BST 2008
At file:///v/home/vila/src/bzr/experimental/bzr-py26-compat/
------------------------------------------------------------
revno: 3741
revision-id: v.ladeuil+lp at free.fr-20080926144520-nvwprjsbb927ff9t
parent: v.ladeuil+lp at free.fr-20080926142913-jc6o8wy92nvbkxa1
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: deprecations
timestamp: Fri 2008-09-26 16:45:20 +0200
message:
Fix python-2.6 BaseException 'message' attribute deprecation.
* bzrlib/util/configobj/configobj.py:
(ConfigObjError.__init__): 'message' attribute has been
deprecated. Reported upstream with patch, hopefully next upgrade
will include it. Watch for conflicts though.
* bzrlib/errors.py:
(BzrError._format): 'message' attribute has been deprecated.
-------------- next part --------------
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py 2008-09-10 17:33:01 +0000
+++ b/bzrlib/errors.py 2008-09-26 14:45:20 +0000
@@ -81,7 +81,8 @@
parameters.
:param msg: If given, this is the literal complete text for the error,
- not subject to expansion.
+ not subject to expansion. 'msg' is used instead of 'message' because
+ python evolved and, in 2.6, forbids the use of 'message'.
"""
StandardError.__init__(self)
if msg is not None:
@@ -102,9 +103,6 @@
fmt = self._get_format_string()
if fmt:
d = dict(self.__dict__)
- # special case: python2.5 puts the 'message' attribute in a
- # slot, so it isn't seen in __dict__
- d['message'] = getattr(self, 'message', 'no message')
s = fmt % d
# __str__() should always return a 'str' object
# never a 'unicode' object.
@@ -126,7 +124,7 @@
# return a unicode object.
u = unicode(u)
return u
-
+
def __str__(self):
s = self._format()
if isinstance(s, unicode):
@@ -204,7 +202,7 @@
class AlreadyBuilding(BzrError):
-
+
_fmt = "The tree builder is already building a tree."
@@ -216,12 +214,12 @@
class BzrCheckError(InternalBzrError):
-
- _fmt = "Internal check failed: %(message)s"
-
- def __init__(self, message):
+
+ _fmt = "Internal check failed: %(msg)s"
+
+ def __init__(self, msg):
BzrError.__init__(self)
- self.message = message
+ self.msg = msg
class DirstateCorrupt(BzrError):
@@ -1310,11 +1308,11 @@
class WeaveError(BzrError):
- _fmt = "Error in processing weave: %(message)s"
+ _fmt = "Error in processing weave: %(msg)s"
- def __init__(self, message=None):
+ def __init__(self, msg=None):
BzrError.__init__(self)
- self.message = message
+ self.msg = msg
class WeaveRevisionAlreadyPresent(WeaveError):
@@ -1673,7 +1671,7 @@
if filename is None:
filename = ""
message = "Error(s) parsing config file %s:\n%s" % \
- (filename, ('\n'.join(e.message for e in errors)))
+ (filename, ('\n'.join(e.msg for e in errors)))
BzrError.__init__(self, message)
=== modified file 'bzrlib/util/configobj/configobj.py'
--- a/bzrlib/util/configobj/configobj.py 2008-02-27 21:36:16 +0000
+++ b/bzrlib/util/configobj/configobj.py 2008-09-26 14:45:20 +0000
@@ -250,11 +250,11 @@
This is the base class for all errors that ConfigObj raises.
It is a subclass of SyntaxError.
"""
- def __init__(self, message='', line_number=None, line=''):
+ def __init__(self, msg='', line_number=None, line=''):
self.line = line
self.line_number = line_number
- self.message = message
- SyntaxError.__init__(self, message)
+ self.msg = msg
+ SyntaxError.__init__(self, msg)
class NestingError(ConfigObjError):
More information about the bazaar-commits
mailing list