From 629c22b1a951ae54b3541dbbce19456cf5e9ce63 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Mon, 26 May 2008 08:17:14 +0000
Subject: [PATCH] make getSortedPreference also returned System Preference
 besides Preference

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21114 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Form/PreferenceTool.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/product/ERP5Form/PreferenceTool.py b/product/ERP5Form/PreferenceTool.py
index 3e6a2cb008..47e210acbc 100644
--- a/product/ERP5Form/PreferenceTool.py
+++ b/product/ERP5Form/PreferenceTool.py
@@ -207,7 +207,6 @@ class PreferenceTool(BaseTool):
     """ set the preference on the active Preference object"""
     self.getActivePreference()._edit(**{pref_name:value})
 
-  security.declarePrivate('_getSortedPreferenceList')
   def _getSortedPreferenceList(self, *args, **kw) :
     """ return the most appropriate preferences objects,
         sorted so that the first in the list should be applied first
@@ -230,7 +229,10 @@ class PreferenceTool(BaseTool):
         else :
           prefs.append(pref)
     prefs.sort(lambda b, a: cmp(a.getPriority(), b.getPriority()))
-    return prefs
+    # add system preferences after user preferences
+    sys_prefs = [x.getObject() for x in self.searchFolder(portal_type='System Preference', **kw)]
+    sys_prefs.sort(lambda b, a: cmp(a.getPriority(), b.getPriority()))
+    return prefs + sys_prefs
 
   security.declareProtected(Permissions.View, 'getActivePreference')
   def getActivePreference(self) :
-- 
2.30.9