mirror of https://gitlab.com/bashrc2/epicyon
Write hashtag index in one go
parent
52697e5437
commit
94f9daeec4
14
inbox.py
14
inbox.py
|
@ -256,13 +256,17 @@ def store_hash_tags(base_dir: str, nickname: str, domain: str,
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + tags_filename)
|
print('EX: unable to write ' + tags_filename)
|
||||||
else:
|
else:
|
||||||
if post_url not in open(tags_filename).read():
|
content = ''
|
||||||
try:
|
try:
|
||||||
with open(tags_filename, 'r+') as tags_file:
|
with open(tags_filename, 'r') as tags_file:
|
||||||
content = tags_file.read()
|
content = tags_file.read()
|
||||||
if tag_line not in content:
|
except OSError:
|
||||||
tags_file.seek(0, 0)
|
pass
|
||||||
tags_file.write(tag_line + content)
|
if post_url not in content:
|
||||||
|
content = tag_line + content
|
||||||
|
try:
|
||||||
|
with open(tags_filename, 'w+') as tags_file:
|
||||||
|
tags_file.write(content)
|
||||||
except OSError as ex:
|
except OSError as ex:
|
||||||
print('EX: Failed to write entry to tags file ' +
|
print('EX: Failed to write entry to tags file ' +
|
||||||
tags_filename + ' ' + str(ex))
|
tags_filename + ' ' + str(ex))
|
||||||
|
|
Loading…
Reference in New Issue