Commit 629c22b1 authored by Aurel's avatar Aurel

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
parent 211674ac
...@@ -207,7 +207,6 @@ class PreferenceTool(BaseTool): ...@@ -207,7 +207,6 @@ class PreferenceTool(BaseTool):
""" set the preference on the active Preference object""" """ set the preference on the active Preference object"""
self.getActivePreference()._edit(**{pref_name:value}) self.getActivePreference()._edit(**{pref_name:value})
security.declarePrivate('_getSortedPreferenceList')
def _getSortedPreferenceList(self, *args, **kw) : def _getSortedPreferenceList(self, *args, **kw) :
""" return the most appropriate preferences objects, """ return the most appropriate preferences objects,
sorted so that the first in the list should be applied first sorted so that the first in the list should be applied first
...@@ -230,7 +229,10 @@ class PreferenceTool(BaseTool): ...@@ -230,7 +229,10 @@ class PreferenceTool(BaseTool):
else : else :
prefs.append(pref) prefs.append(pref)
prefs.sort(lambda b, a: cmp(a.getPriority(), b.getPriority())) 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') security.declareProtected(Permissions.View, 'getActivePreference')
def getActivePreference(self) : def getActivePreference(self) :
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment