[Zope3-checkins] SVN: Zope3/trunk/src/zope/configuration/config.py Fix Python 2.4 compatibility.

Fred L. Drake, Jr. fred at zope.com
Wed Jun 23 16:45:43 EDT 2004


Log message for revision 25964:
Fix Python 2.4 compatibility.
Merged from revision 25960 on the ZopeX3-3.0 branch.

The output of ConfigurationConflictError.__str__() depended on the
order items were retrieved from a dictionary; sorting the items prior
to presentation avoids dependence on both the string hashing algorithm
and insertion order, allowing the expected output to be portable
across Python versions.



-=-
Modified: Zope3/trunk/src/zope/configuration/config.py
===================================================================
--- Zope3/trunk/src/zope/configuration/config.py	2004-06-23 20:36:10 UTC (rev 25963)
+++ Zope3/trunk/src/zope/configuration/config.py	2004-06-23 20:45:43 UTC (rev 25964)
@@ -1469,7 +1469,9 @@
 
     def __str__(self):
         r = ["Conflicting configuration actions"]
-        for discriminator, infos in self._conflicts.items():
+        items = self._conflicts.items()
+        items.sort()
+        for discriminator, infos in items:
             r.append("  For: %s" % (discriminator, ))
             for info in infos:
                 for line in unicode(info).rstrip().split(u'\n'):



More information about the Zope3-Checkins mailing list