[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xm: fix message in OptionError deprecated since Python 2.6
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1259743669 0 # Node ID c3373757a5d6d9747379fa2ad575d7b8c12e25b7 # Parent 6ff4e4a66b1688f0ff5ac3b11e354c31bd69f30d xm: fix message in OptionError deprecated since Python 2.6 BaseException.message has been deprecated since Python 2.6. To prevent DeprecationWarning from popping up over this pre-existing attribute, use a new property that takes lookup precedence. Signed-off-by: Wei Kong <weikong.cn@xxxxxxxxx> --- tools/python/xen/xm/opts.py | 9 +++++++++ 1 files changed, 9 insertions(+) diff -r 6ff4e4a66b16 -r c3373757a5d6 tools/python/xen/xm/opts.py --- a/tools/python/xen/xm/opts.py Wed Dec 02 08:46:47 2009 +0000 +++ b/tools/python/xen/xm/opts.py Wed Dec 02 08:47:49 2009 +0000 @@ -55,10 +55,19 @@ def wrap(text, width = 70): return lines class OptionError(Exception): + def _get_message(self): + return self.__message + + def _set_message(self, value): + self.__message = value + + message = property(_get_message, _set_message) + """Denotes an error in option parsing.""" def __init__(self, message, usage = ''): self.message = message self.usage = usage + Exception.__init__(self, message) def __str__(self): return self.message _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |