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

Fred L. Drake, Jr. fred at zope.com
Wed Jun 23 15:38:54 EDT 2004


Log message for revision 25960:
Fix Python 2.4 compatibility.

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/branches/ZopeX3-3.0/src/zope/configuration/config.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/configuration/config.py	2004-06-23 19:38:37 UTC (rev 25959)
+++ Zope3/branches/ZopeX3-3.0/src/zope/configuration/config.py	2004-06-23 19:38:53 UTC (rev 25960)
@@ -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