Mercurial > libervia-web
changeset 1491:3002ea1d6ae9
pages (blog/view): don't use backend cache when "no cache" is requested
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 26 Jan 2022 10:24:46 +0100 |
parents | 774a81a6e8b5 |
children | 3a34d78f2717 |
files | libervia/pages/blog/view/page_meta.py |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libervia/pages/blog/view/page_meta.py Wed Jan 26 10:23:07 2022 +0100 +++ b/libervia/pages/blog/view/page_meta.py Wed Jan 26 10:24:46 2022 +0100 @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import html +from typing import Dict, Any from libervia.server.constants import Const as C from twisted.words.protocols.jabber import jid from twisted.web import server @@ -118,6 +119,9 @@ async def appendComments(self, request, blog_items, profile): await self.fillMissingIdentities( request, [i['author_jid'] for i in blog_items['items']]) + extra: Dict[str, Any] = {C.KEY_ORDER_BY: C.ORDER_BY_CREATION} + if not self.useCache(request): + extra[C.KEY_USE_CACHE] = False for blog_item in blog_items['items']: for comment_data in blog_item['comments']: service = comment_data['service'] @@ -129,7 +133,7 @@ C.NO_LIMIT, [], data_format.serialise( - {C.KEY_ORDER_BY: C.ORDER_BY_CREATION} + extra ), profile) except Exception as e: @@ -151,7 +155,7 @@ service: jid.JID, node: str, item_id, - extra: dict, + extra: Dict[str, Any], profile: str ) -> dict: try: @@ -159,6 +163,8 @@ items_id = [item_id] else: items_id = [] + if not self.useCache(request): + extra[C.KEY_USE_CACHE] = False blog_data = await self.host.bridgeCall('mbGet', service.userhost(), node,