Commit 66c38dcb authored by Jérome Perrin's avatar Jérome Perrin

user_name= was just passed to make the cache vary, instead generate a cache key

containing user name, so that user_name parameter is not mixed with standard
parameters.
Don't pass positional arguments to searchFolder, because it does not support
any.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16280 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1c1c32f2
......@@ -124,7 +124,7 @@ class PreferenceMethod(Method):
self._null = (None, '', (), [])
def __call__(self, instance, *args, **kw):
def _getPreference(user_name=None, *args, **kw):
def _getPreference(*args, **kw):
value = None
for pref in instance._getSortedPreferenceList(*args, **kw):
value = getattr(pref, self._preference_name, _marker)
......@@ -136,10 +136,10 @@ class PreferenceMethod(Method):
break
return value
_getPreference = CachingMethod(_getPreference,
id=self._preference_cache_id,
id='%s.%s' % (self._preference_cache_id,
getSecurityManager().getUser().getId()),
cache_factory='erp5_ui_short')
user_name = getSecurityManager().getUser().getId()
value = _getPreference(user_name=user_name, *args, **kw)
value = _getPreference(*args, **kw)
# XXX Preference Tool has a strange assumption that, even if
# all values are null values, one of them must be returned.
# Therefore, return a default value, only if explicitly specified,
......@@ -210,7 +210,7 @@ class PreferenceTool(BaseTool):
# or better solution
user = getToolByName(self, 'portal_membership').getAuthenticatedMember()
user_is_manager = 'Manager' in user.getRolesInContext(self)
for pref in self.searchFolder(portal_type='Preference', *args, **kw) :
for pref in self.searchFolder(portal_type='Preference', **kw) :
pref = pref.getObject()
if pref is not None and pref.getProperty('preference_state',
'broken') in ('enabled', 'global'):
......
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