WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xm: fix message in OptionError deprecated

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xm: fix message in OptionError deprecated since Python 2.6
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 02 Dec 2009 00:55:24 -0800
Delivery-date: Wed, 02 Dec 2009 00:55:44 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xm: fix message in OptionError deprecated since Python 2.6, Xen patchbot-unstable <=