[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/utility/vocabulary.py Sort the items by the token, therefore the name. This makes it easier to

Stephan Richter srichter at cosmos.phy.tufts.edu
Sun May 23 07:57:31 EDT 2004


Log message for revision 24902:
Sort the items by the token, therefore the name. This makes it easier to 
find entries in the UI.




-=-
Modified: Zope3/trunk/src/zope/app/utility/vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/vocabulary.py	2004-05-23 11:54:37 UTC (rev 24901)
+++ Zope3/trunk/src/zope/app/utility/vocabulary.py	2004-05-23 11:57:31 UTC (rev 24902)
@@ -230,7 +230,10 @@
 
     def __iter__(self):
         """See zope.schema.interfaces.IIterableVocabulary"""
-        return iter(self._terms.values())
+        # Sort the terms by the token (utility name)
+        values = self._terms.values()
+        values.sort(lambda x, y: cmp(x.token, y.token))
+        return iter(values)
 
     def __len__(self):
         """See zope.schema.interfaces.IIterableVocabulary"""




More information about the Zope3-Checkins mailing list