From 68db51ea94af97701fb5c0dc50dabb52cdd6acce Mon Sep 17 00:00:00 2001 From: "Schimon Jehudah, Adv." Date: Wed, 20 Nov 2024 17:42:56 +0200 Subject: [PATCH] Correct path of JSON files in which indices are stored. --- rivista/http/instance.py | 6 +++--- rivista/json/index.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rivista/http/instance.py b/rivista/http/instance.py index 2dcb4dd..429a1bb 100644 --- a/rivista/http/instance.py +++ b/rivista/http/instance.py @@ -58,7 +58,7 @@ class HttpInstance: pubsub = request.query_params.get('pubsub', '') result = None if settings['service']: - if settings['include'] in pubsub or not settings['include']: + if not settings['include'] or settings['include'] in pubsub: if pubsub: iq = await XmppXep0060.get_nodes(xmpp, pubsub) if iq: @@ -104,7 +104,7 @@ class HttpInstance: item_id = request.query_params.get('item', '') result = None if settings['service']: - if settings['include'] in pubsub or not settings['include']: + if not settings['include'] or settings['include'] in pubsub: if pubsub and node and item_id: iq = await XmppXep0060.get_node_item(xmpp, pubsub, node, item_id) if iq: @@ -130,7 +130,7 @@ class HttpInstance: 'link' : ('xmpp:{}?message;subject=Rivista;body=Greetings! ' 'I am contacting you to inform you that there is an error listing ' 'node items for Node {} on PubSub {}.').format(operator, node, pubsub)}] - filename = 'data/{}.json'.format(node) + filename = os.path.join(directory_cache_json, 'json', f'{node}.json') with open(filename, 'w', encoding='utf-8') as f: json.dump(json_data, f, ensure_ascii=False, indent=4) else: diff --git a/rivista/json/index.py b/rivista/json/index.py index 30a5301..340643f 100644 --- a/rivista/json/index.py +++ b/rivista/json/index.py @@ -32,7 +32,7 @@ class JsonIndex: directory = os.path.join(directory_cache_json, pubsub) if not os.path.exists(directory): os.mkdir(directory) - filename = os.path.join(directory_cache_json, pubsub, node) + filename = os.path.join(directory_cache_json, pubsub, f'{node}.json') with open(filename, 'w', encoding='utf-8') as f: json.dump(json_data, f, ensure_ascii=False, indent=4)