[Checkins] SVN:	ZConfig/trunk/ZConfig/components/logger/tests/test_logger.py	fix problem with Python 2.5.0 compatibility
    Fred L. Drake, Jr. 
    fdrake at gmail.com
       
    Fri Dec  5 12:56:30 EST 2008
    
    
  
Log message for revision 93660:
  fix problem with Python 2.5.0 compatibility
Changed:
  U   ZConfig/trunk/ZConfig/components/logger/tests/test_logger.py
-=-
Modified: ZConfig/trunk/ZConfig/components/logger/tests/test_logger.py
===================================================================
--- ZConfig/trunk/ZConfig/components/logger/tests/test_logger.py	2008-12-05 17:47:32 UTC (rev 93659)
+++ ZConfig/trunk/ZConfig/components/logger/tests/test_logger.py	2008-12-05 17:56:30 UTC (rev 93660)
@@ -369,8 +369,18 @@
     def test_filehandler_reopen(self):
 
         def mkrecord(msg):
-            return logging.LogRecord(
-                "foo.bar", logging.ERROR, __file__, 42, msg, (), ())
+            #
+            # Python 2.5.0 added an additional required argument to the
+            # LogRecord constructor, making it incompatible with prior
+            # versions.  Python 2.5.1 corrected the bug by making the
+            # additional argument optional.  We deal with 2.5.0 by adding
+            # the extra arg in only that case, using the default value
+            # from Python 2.5.1.
+            #
+            args = ["foo.bar", logging.ERROR, __file__, 42, msg, (), ()]
+            if sys.version_info[:3] == (2, 5, 0):
+                args.append(None)
+            return logging.LogRecord(*args)
 
         # This goes through the reopening operation *twice* to make
         # sure that we don't lose our handle on the handler the first
    
    
More information about the Checkins
mailing list