[Checkins] SVN: z3c.preference/trunk/ Sorting preferences in ``CategoryEditForm`` by their `id` to stabialize sort order.

Michael Howitz cvs-admin at zope.org
Sat Mar 9 14:01:55 UTC 2013


Log message for revision 130075:
  Sorting preferences in ``CategoryEditForm`` by their `id` to stabialize sort order.
  

Changed:
  U   z3c.preference/trunk/CHANGES.txt
  U   z3c.preference/trunk/src/z3c/preference/browser.py
  U   z3c.preference/trunk/src/z3c/preference/categories.txt

-=-
Modified: z3c.preference/trunk/CHANGES.txt
===================================================================
--- z3c.preference/trunk/CHANGES.txt	2013-03-09 13:52:47 UTC (rev 130074)
+++ z3c.preference/trunk/CHANGES.txt	2013-03-09 14:01:55 UTC (rev 130075)
@@ -5,7 +5,8 @@
 0.5 (unreleased)
 ----------------
 
-- Nothing changed yet.
+- Sorting preferences in ``CategoryEditForm`` by their `id` to stabialize
+  sort order.
 
 
 0.4 (2012-04-20)

Modified: z3c.preference/trunk/src/z3c/preference/browser.py
===================================================================
--- z3c.preference/trunk/src/z3c/preference/browser.py	2013-03-09 13:52:47 UTC (rev 130074)
+++ z3c.preference/trunk/src/z3c/preference/browser.py	2013-03-09 14:01:55 UTC (rev 130075)
@@ -53,6 +53,7 @@
 
     def __init__(self, *args, **kw):
         super(CategoryEditForm, self).__init__(*args, **kw)
+        sorted_prefs = sorted(self.context.items(), key=lambda x: x[0])
         groups = [PreferenceGroup(pref, self.request, self)
-                  for pref in self.context.values()]
+                  for key, pref in sorted_prefs]
         self.groups = tuple(groups)

Modified: z3c.preference/trunk/src/z3c/preference/categories.txt
===================================================================
--- z3c.preference/trunk/src/z3c/preference/categories.txt	2013-03-09 13:52:47 UTC (rev 130074)
+++ z3c.preference/trunk/src/z3c/preference/categories.txt	2013-03-09 14:01:55 UTC (rev 130075)
@@ -66,6 +66,13 @@
   ...           />
   ...
   ...       <preferenceGroup
+  ...           id="app.search"
+  ...           title="Search Settings"
+  ...           schema="z3c.preference.categories.ISearchSettings"
+  ...           category="false"
+  ...           />
+  ...
+  ...       <preferenceGroup
   ...           id="app.rss"
   ...           title="RSS Settings"
   ...           description="Settings for the RSS feeds"
@@ -73,13 +80,6 @@
   ...           category="false"
   ...           />
   ...
-  ...       <preferenceGroup
-  ...           id="app.search"
-  ...           title="Search Settings"
-  ...           schema="z3c.preference.categories.ISearchSettings"
-  ...           category="false"
-  ...           />
-  ...
   ...     </configure>''', context)
 
 



More information about the checkins mailing list