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-devel

[Xen-devel] [PATCH] xm: fix message in OptionError deprecated since Pyth

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] xm: fix message in OptionError deprecated since Python 2.6
From: Wei Kong <weikong.cn@xxxxxxxxx>
Date: Wed, 2 Dec 2009 12:03:19 +0800
Delivery-date: Tue, 01 Dec 2009 20:03:46 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=AIZSfPQj6ViW+fWNyl0oIN97MTGuqMdETZbKZBpwedY=; b=IZWcZ9FPP1pDmguGTenmX4rbUhQQyyW29s1h4kH4D1kVLO8R3c78tlfSxGDSoSseyQ vL/i+piSSOGvYKjJbUUE7ANEaOs9c/6mP0iv4MuhOsGS7cqrNqCzVBoGX4NozDS54Ruh QKCZJfIviGlcwMw3chphzHYK+XQY5lOIgD9LU=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=HH2T00RFqKkNY3kB8++aiN8LIVy/dtvrrTUTsC6++CD/KEWpT/1v2A+bwSkgBC8d6X Vc3pD7Kgk28fLCuFTE37v5hfMcvqWC4rI2B7IUvmQ+nE0HlbN9JiTDFu9bob6Cx3hxgp Z5MXFbO9BOiWdu0i+Ul+XwpA5O3XGBWQ2Qub4=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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@gmail.com>

--
--- xen-unstable.hg/tools/python/xen/xm/opts.py 2009-12-02 09:46:51.000000000 +0800
+++ xen-unstable.hg/tools/python/xen/xm/opts.py 2009-12-02 11:56:35.000000000 +0800
@@ -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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] xm: fix message in OptionError deprecated since Python 2.6, Wei Kong <=