[Checkins] SVN: zope.configuration/trunk/ - Fixed Python 2.4 backwards incompat (itemgetter used with multiple args);

Chris McDonough chrism at plope.com
Wed Dec 7 21:16:38 UTC 2011


Log message for revision 123625:
  - Fixed Python 2.4 backwards incompat (itemgetter used with multiple args);
    Python 2.4 now works (at least if you use zope.schema == 3.8.1).
  
  -This line, and those below, will be ignored--
  
  M    CHANGES.txt
  M    src/zope/configuration/config.py
  

Changed:
  U   zope.configuration/trunk/CHANGES.txt
  U   zope.configuration/trunk/src/zope/configuration/config.py

-=-
Modified: zope.configuration/trunk/CHANGES.txt
===================================================================
--- zope.configuration/trunk/CHANGES.txt	2011-12-07 19:21:38 UTC (rev 123624)
+++ zope.configuration/trunk/CHANGES.txt	2011-12-07 21:16:37 UTC (rev 123625)
@@ -5,7 +5,8 @@
 3.8.1 (unreleased)
 ------------------
 
-- ...
+- Fixed Python 2.4 backwards incompat (itemgetter used with multiple args);
+  Python 2.4 now works (at least if you use zope.schema == 3.8.1).
 
 3.8.0 (2011-12-06)
 ------------------

Modified: zope.configuration/trunk/src/zope/configuration/config.py
===================================================================
--- zope.configuration/trunk/src/zope/configuration/config.py	2011-12-07 19:21:38 UTC (rev 123624)
+++ zope.configuration/trunk/src/zope/configuration/config.py	2011-12-07 21:16:37 UTC (rev 123625)
@@ -1685,8 +1685,10 @@
     if conflicts:
         raise ConfigurationConflictError(conflicts)
 
-    # sort conflict-resolved actions by (order, i) and return them
-    return [ x[2] for x in sorted(output, key=operator.itemgetter(0, 1))]
+    # Sort conflict-resolved actions by (order, i) and return them.  Wanted
+    # to use operator.itemgetter(0, 1) instead of the lambda below but that
+    # doesn't work on Py24.
+    return [ x[2] for x in sorted( output, key=lambda ai: (ai[0], ai[1]) ) ]
 
 class ConfigurationConflictError(ConfigurationError):
 



More information about the checkins mailing list