# HG changeset patch # User Goffi # Date 1555070282 -7200 # Node ID 7d2e098ea3f46c951ee3f8e2faf71d4995aac7be # Parent 5baf7ece44a032a892198f7156aa7735d36ab27e pages (cache): separate cached pages using locales, to avoid having a page cache in a specific locale used for an other one. diff -r 5baf7ece44a0 -r 7d2e098ea3f4 libervia/server/pages.py --- a/libervia/server/pages.py Wed Apr 10 21:06:35 2019 +0200 +++ b/libervia/server/pages.py Fri Apr 12 13:58:02 2019 +0200 @@ -927,9 +927,14 @@ if profile != C.SERVICE_PROFILE: #  only service profile is cache for now return + session_data = self.host.getSessionData(request, session_iface.ISATSession) + locale = session_data.locale + if locale == C.DEFAULT_LOCALE: + # no need to duplicate cache here + locale = None try: cache = (self.cache[profile][cache_type][service][node] - [self.vhost_root][request.uri][self]) + [self.vhost_root][request.uri][locale][self]) except KeyError: # no cache yet, let's subscribe to the pubsub node d1 = self.host.bridgeCall( @@ -940,7 +945,7 @@ d2 = self.host.bridgeCall("psNodeWatchAdd", service.full(), node, profile) d2.addErrback(self.psNodeWatchAddEb, service, node) self._do_cache = [self, profile, cache_type, service, node, - self.vhost_root, request.uri] + self.vhost_root, request.uri, locale] #  we don't return the Deferreds as it is not needed to wait for # the subscription to continue with page rendering return