mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
0108eb3fa8
commit
d9ee8a3ff8
4
posts.py
4
posts.py
|
@ -63,7 +63,7 @@ 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 locate_news_votes
|
from utils import locate_news_votes
|
||||||
from utils import locateNewsArrival
|
from utils import locate_news_arrival
|
||||||
from utils import votes_on_newswire_item
|
from utils import votes_on_newswire_item
|
||||||
from utils import remove_html
|
from utils import remove_html
|
||||||
from utils import dangerous_markup
|
from utils import dangerous_markup
|
||||||
|
@ -3618,7 +3618,7 @@ def _passedNewswireVoting(newswire_votes_threshold: int,
|
||||||
# note that the presence of an arrival file also indicates
|
# note that the presence of an arrival file also indicates
|
||||||
# that this post is moderated
|
# that this post is moderated
|
||||||
arrivalDate = \
|
arrivalDate = \
|
||||||
locateNewsArrival(base_dir, domain, post_filename)
|
locate_news_arrival(base_dir, domain, post_filename)
|
||||||
if not arrivalDate:
|
if not arrivalDate:
|
||||||
return True
|
return True
|
||||||
# how long has elapsed since this post arrived?
|
# how long has elapsed since this post arrived?
|
||||||
|
|
28
utils.py
28
utils.py
|
@ -1266,32 +1266,32 @@ def locate_news_votes(base_dir: str, domain: str,
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def locateNewsArrival(base_dir: str, domain: str,
|
def locate_news_arrival(base_dir: str, domain: str,
|
||||||
postUrl: str) -> str:
|
post_url: str) -> str:
|
||||||
"""Returns the arrival time for a news post
|
"""Returns the arrival time 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 + '.arrived'
|
post_url = post_url + '.arrived'
|
||||||
else:
|
else:
|
||||||
postUrl = postUrl + '.json.arrived'
|
post_url = post_url + '.json.arrived'
|
||||||
|
|
||||||
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):
|
||||||
with open(post_filename, 'r') as arrivalFile:
|
with open(post_filename, 'r') as arrival_file:
|
||||||
arrival = arrivalFile.read()
|
arrival = arrival_file.read()
|
||||||
if arrival:
|
if arrival:
|
||||||
arrivalDate = \
|
arrival_date = \
|
||||||
datetime.datetime.strptime(arrival,
|
datetime.datetime.strptime(arrival,
|
||||||
"%Y-%m-%dT%H:%M:%SZ")
|
"%Y-%m-%dT%H:%M:%SZ")
|
||||||
return arrivalDate
|
return arrival_date
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue