From 75e02ba2dec93a7c4b84ebb7f9aa1e02033dad79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 27 Oct 2013 19:27:19 +0100 Subject: [PATCH] User.get_preferences must return a copy preferences is stored in the cache but as it is a mutable object, we must return a copy to prevent cache corruption. issue3442 review1351002 --- trytond/res/user.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/res/user.py b/trytond/res/user.py index 2cd6e6dc74..e50c8fd9db 100644 --- a/trytond/res/user.py +++ b/trytond/res/user.py @@ -342,13 +342,13 @@ class User(ModelSQL, ModelView): key = (Transaction().user, context_only) preferences = cls._get_preferences_cache.get(key) if preferences is not None: - return preferences + return preferences.copy() user = Transaction().user with Transaction().set_user(0): user = cls(user) preferences = cls._get_preferences(user, context_only=context_only) cls._get_preferences_cache.set(key, preferences) - return preferences + return preferences.copy() @classmethod def set_preferences(cls, values, old_password=False):