forked from sch/Rivista
Correct path of JSON files in which indices are stored.
This commit is contained in:
parent
5fd6a6c710
commit
68db51ea94
2 changed files with 4 additions and 4 deletions
|
@ -58,7 +58,7 @@ class HttpInstance:
|
||||||
pubsub = request.query_params.get('pubsub', '')
|
pubsub = request.query_params.get('pubsub', '')
|
||||||
result = None
|
result = None
|
||||||
if settings['service']:
|
if settings['service']:
|
||||||
if settings['include'] in pubsub or not settings['include']:
|
if not settings['include'] or settings['include'] in pubsub:
|
||||||
if pubsub:
|
if pubsub:
|
||||||
iq = await XmppXep0060.get_nodes(xmpp, pubsub)
|
iq = await XmppXep0060.get_nodes(xmpp, pubsub)
|
||||||
if iq:
|
if iq:
|
||||||
|
@ -104,7 +104,7 @@ class HttpInstance:
|
||||||
item_id = request.query_params.get('item', '')
|
item_id = request.query_params.get('item', '')
|
||||||
result = None
|
result = None
|
||||||
if settings['service']:
|
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:
|
if pubsub and node and item_id:
|
||||||
iq = await XmppXep0060.get_node_item(xmpp, pubsub, node, item_id)
|
iq = await XmppXep0060.get_node_item(xmpp, pubsub, node, item_id)
|
||||||
if iq:
|
if iq:
|
||||||
|
@ -130,7 +130,7 @@ class HttpInstance:
|
||||||
'link' : ('xmpp:{}?message;subject=Rivista;body=Greetings! '
|
'link' : ('xmpp:{}?message;subject=Rivista;body=Greetings! '
|
||||||
'I am contacting you to inform you that there is an error listing '
|
'I am contacting you to inform you that there is an error listing '
|
||||||
'node items for Node {} on PubSub {}.').format(operator, node, pubsub)}]
|
'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:
|
with open(filename, 'w', encoding='utf-8') as f:
|
||||||
json.dump(json_data, f, ensure_ascii=False, indent=4)
|
json.dump(json_data, f, ensure_ascii=False, indent=4)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -32,7 +32,7 @@ class JsonIndex:
|
||||||
directory = os.path.join(directory_cache_json, pubsub)
|
directory = os.path.join(directory_cache_json, pubsub)
|
||||||
if not os.path.exists(directory):
|
if not os.path.exists(directory):
|
||||||
os.mkdir(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:
|
with open(filename, 'w', encoding='utf-8') as f:
|
||||||
json.dump(json_data, f, ensure_ascii=False, indent=4)
|
json.dump(json_data, f, ensure_ascii=False, indent=4)
|
||||||
|
|
Loading…
Reference in a new issue