Snake case

merge-requests/30/head
Bob Mottram 2021-12-27 22:38:48 +00:00
parent 83880bd0b4
commit 0108eb3fa8
2 changed files with 12 additions and 12 deletions

View File

@ -62,7 +62,7 @@ from utils import locate_post
from utils import load_json
from utils import save_json
from utils import get_config_param
from utils import locateNewsVotes
from utils import locate_news_votes
from utils import locateNewsArrival
from utils import votes_on_newswire_item
from utils import remove_html
@ -3632,7 +3632,7 @@ def _passedNewswireVoting(newswire_votes_threshold: int,
return False
# if there a votes file for this post?
votesFilename = \
locateNewsVotes(base_dir, domain, post_filename)
locate_news_votes(base_dir, domain, post_filename)
if not votesFilename:
return True
# load the votes file and count the votes

View File

@ -1242,24 +1242,24 @@ def votes_on_newswire_item(status: []) -> int:
return total_votes
def locateNewsVotes(base_dir: str, domain: str,
postUrl: str) -> str:
def locate_news_votes(base_dir: str, domain: str,
post_url: str) -> str:
"""Returns the votes filename for a news post
within the news user account
"""
postUrl = \
postUrl.strip().replace('\n', '').replace('\r', '')
post_url = \
post_url.strip().replace('\n', '').replace('\r', '')
# 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'):
postUrl = postUrl + '.votes'
if post_url.endswith('.json'):
post_url = post_url + '.votes'
else:
postUrl = postUrl + '.json.votes'
post_url = post_url + '.json.votes'
accountDir = base_dir + '/accounts/news@' + domain + '/'
post_filename = accountDir + 'outbox/' + postUrl
account_dir = base_dir + '/accounts/news@' + domain + '/'
post_filename = account_dir + 'outbox/' + post_url
if os.path.isfile(post_filename):
return post_filename