mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
83880bd0b4
commit
0108eb3fa8
4
posts.py
4
posts.py
|
@ -62,7 +62,7 @@ from utils import locate_post
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
from utils import save_json
|
from utils import save_json
|
||||||
from utils import get_config_param
|
from utils import get_config_param
|
||||||
from utils import locateNewsVotes
|
from utils import locate_news_votes
|
||||||
from utils import locateNewsArrival
|
from utils import locateNewsArrival
|
||||||
from utils import votes_on_newswire_item
|
from utils import votes_on_newswire_item
|
||||||
from utils import remove_html
|
from utils import remove_html
|
||||||
|
@ -3632,7 +3632,7 @@ def _passedNewswireVoting(newswire_votes_threshold: int,
|
||||||
return False
|
return False
|
||||||
# if there a votes file for this post?
|
# if there a votes file for this post?
|
||||||
votesFilename = \
|
votesFilename = \
|
||||||
locateNewsVotes(base_dir, domain, post_filename)
|
locate_news_votes(base_dir, domain, post_filename)
|
||||||
if not votesFilename:
|
if not votesFilename:
|
||||||
return True
|
return True
|
||||||
# load the votes file and count the votes
|
# load the votes file and count the votes
|
||||||
|
|
20
utils.py
20
utils.py
|
@ -1242,24 +1242,24 @@ def votes_on_newswire_item(status: []) -> int:
|
||||||
return total_votes
|
return total_votes
|
||||||
|
|
||||||
|
|
||||||
def locateNewsVotes(base_dir: str, domain: str,
|
def locate_news_votes(base_dir: str, domain: str,
|
||||||
postUrl: str) -> str:
|
post_url: str) -> str:
|
||||||
"""Returns the votes filename for a news post
|
"""Returns the votes filename for a news post
|
||||||
within the news user account
|
within the news user account
|
||||||
"""
|
"""
|
||||||
postUrl = \
|
post_url = \
|
||||||
postUrl.strip().replace('\n', '').replace('\r', '')
|
post_url.strip().replace('\n', '').replace('\r', '')
|
||||||
|
|
||||||
# if this post in the shared inbox?
|
# if this post in the shared inbox?
|
||||||
postUrl = remove_id_ending(postUrl.strip()).replace('/', '#')
|
post_url = remove_id_ending(post_url.strip()).replace('/', '#')
|
||||||
|
|
||||||
if postUrl.endswith('.json'):
|
if post_url.endswith('.json'):
|
||||||
postUrl = postUrl + '.votes'
|
post_url = post_url + '.votes'
|
||||||
else:
|
else:
|
||||||
postUrl = postUrl + '.json.votes'
|
post_url = post_url + '.json.votes'
|
||||||
|
|
||||||
accountDir = base_dir + '/accounts/news@' + domain + '/'
|
account_dir = base_dir + '/accounts/news@' + domain + '/'
|
||||||
post_filename = accountDir + 'outbox/' + postUrl
|
post_filename = account_dir + 'outbox/' + post_url
|
||||||
if os.path.isfile(post_filename):
|
if os.path.isfile(post_filename):
|
||||||
return post_filename
|
return post_filename
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue