# HG changeset patch # User Thierry Florac # Date 1532011553 -7200 # Node ID 0734dda7bc82dd1e42ff2855263ad8bd440408d8 # Parent 8dc4a35478d4c9e37ad0bdeb3af559e0e45e59a8 Use locale name in request cache key diff -r 8dc4a35478d4 -r 0734dda7bc82 src/pyams_portal/portlet.py --- a/src/pyams_portal/portlet.py Fri Jul 13 16:46:41 2018 +0200 +++ b/src/pyams_portal/portlet.py Thu Jul 19 16:45:53 2018 +0200 @@ -170,8 +170,8 @@ PORTLETS_CACHE_REGION = 'portlets' PORTLETS_CACHE_NAME = 'PyAMS::portlet' -PORTLETS_CACHE_KEY = 'portlet::{portlet}::{context}' -PORTLETS_CACHE_DISPLAY_CONTEXT_KEY = 'portlet::{portlet}::{context}::{display}' +PORTLETS_CACHE_KEY = 'portlet::{portlet}::{context}::{lang}' +PORTLETS_CACHE_DISPLAY_CONTEXT_KEY = 'portlet::{portlet}::{context}::{display}::{lang}' @implementer(IPortletRenderer) @@ -218,11 +218,13 @@ display_context = self.request.annotations.get(DISPLAY_CONTEXT) if display_context is None: cache_key = PORTLETS_CACHE_KEY.format(portlet=ICacheKeyValue(self.settings), - context=ICacheKeyValue(self.context)) + context=ICacheKeyValue(self.context), + lang=self.request.locale_name) else: cache_key = PORTLETS_CACHE_DISPLAY_CONTEXT_KEY.format(portlet=ICacheKeyValue(self.settings), context=ICacheKeyValue(self.context), - display=ICacheKeyValue(display_context)) + display=ICacheKeyValue(display_context), + lang=self.request.locale_name) if self.use_authentication: cache_key = '{0}::{1}'.format(cache_key, self.request.principal.id) # load rendered content from cache, or create output and store it in cache