You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by dr...@apache.org on 2010/03/09 06:19:18 UTC

svn commit: r920661 - /incubator/thrift/trunk/lib/py/src/Thrift.py

Author: dreiss
Date: Tue Mar  9 05:19:18 2010
New Revision: 920661

URL: http://svn.apache.org/viewvc?rev=920661&view=rev
Log:
THRIFT-475. python: Eliminate DeprecationWarning

Modified:
    incubator/thrift/trunk/lib/py/src/Thrift.py

Modified: incubator/thrift/trunk/lib/py/src/Thrift.py
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/py/src/Thrift.py?rev=920661&r1=920660&r2=920661&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/py/src/Thrift.py (original)
+++ incubator/thrift/trunk/lib/py/src/Thrift.py Tue Mar  9 05:19:18 2010
@@ -17,6 +17,8 @@
 # under the License.
 #
 
+import sys
+
 class TType:
   STOP   = 0
   VOID   = 1
@@ -53,6 +55,14 @@ class TException(Exception):
 
   """Base class for all thrift exceptions."""
 
+  # BaseException.message is deprecated in Python v[2.6,3.0)
+  if (2,6,0) <= sys.version_info < (3,0):
+    def _get_message(self):
+	    return self._message
+    def _set_message(self, message):
+	    self._message = message
+    message = property(_get_message, _set_message)
+
   def __init__(self, message=None):
     Exception.__init__(self, message)
     self.message = message