[Checkins] SVN: ZConfig/branches/matt-python-2.6/ZConfig/__init__.py Created property to continue using BaseException.message in Python 2.6.

matt@zope.com cvs-admin at zope.org
Tue Nov 18 16:23:31 EST 2008


Log message for revision 93104:
  Created property to continue using BaseException.message in Python 2.6.
  

Changed:
  U   ZConfig/branches/matt-python-2.6/ZConfig/__init__.py

-=-
Modified: ZConfig/branches/matt-python-2.6/ZConfig/__init__.py
===================================================================
--- ZConfig/branches/matt-python-2.6/ZConfig/__init__.py	2008-11-18 20:53:13 UTC (rev 93103)
+++ ZConfig/branches/matt-python-2.6/ZConfig/__init__.py	2008-11-18 21:23:31 UTC (rev 93104)
@@ -44,7 +44,20 @@
 
 class ConfigurationError(Exception):
     """Base class for ZConfig exceptions."""
+ 
+    # The 'message' attribute was deprecated for BaseException with
+    # Python 2.6; here we create descriptor properties to continue using it
+    def __set_message(self, v):
+        self.__dict__['message'] = v
 
+    def __get_message(self):
+        return self.__dict__['message']
+
+    def __del_message(self):
+        del self.__dict__['message']
+
+    message = property(__get_message, __set_message, __del_message)
+
     def __init__(self, msg, url=None):
         self.message = msg
         self.url = url



More information about the Checkins mailing list