diff --git a/posts.py b/posts.py index c18e47258..35f831835 100644 --- a/posts.py +++ b/posts.py @@ -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 diff --git a/utils.py b/utils.py index 94870eea5..18ae70a92 100644 --- a/utils.py +++ b/utils.py @@ -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