mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
47b844152e
commit
49ebb6c88c
6
inbox.py
6
inbox.py
|
@ -25,7 +25,7 @@ from utils import remove_html
|
|||
from utils import fileLastModified
|
||||
from utils import has_object_string
|
||||
from utils import has_object_string_object
|
||||
from utils import getReplyIntervalHours
|
||||
from utils import get_reply_interval_hours
|
||||
from utils import canReplyTo
|
||||
from utils import get_user_paths
|
||||
from utils import get_base_content_from_post
|
||||
|
@ -3111,8 +3111,8 @@ def _createReplyNotificationFile(base_dir: str, nickname: str, domain: str,
|
|||
# check if the reply is within the allowed time period
|
||||
# after publication
|
||||
replyIntervalHours = \
|
||||
getReplyIntervalHours(base_dir, nickname, domain,
|
||||
default_reply_interval_hrs)
|
||||
get_reply_interval_hours(base_dir, nickname, domain,
|
||||
default_reply_interval_hrs)
|
||||
if canReplyTo(base_dir, nickname, domain, inReplyTo,
|
||||
replyIntervalHours):
|
||||
actUrl = local_actor_url(http_prefix, nickname, domain)
|
||||
|
|
34
utils.py
34
utils.py
|
@ -1367,7 +1367,7 @@ def locate_post(base_dir: str, nickname: str, domain: str,
|
|||
return None
|
||||
|
||||
|
||||
def _getPublishedDate(post_json_object: {}) -> str:
|
||||
def _get_published_date(post_json_object: {}) -> str:
|
||||
"""Returns the published date on the given post
|
||||
"""
|
||||
published = None
|
||||
|
@ -1383,19 +1383,19 @@ def _getPublishedDate(post_json_object: {}) -> str:
|
|||
return published
|
||||
|
||||
|
||||
def getReplyIntervalHours(base_dir: str, nickname: str, domain: str,
|
||||
default_reply_interval_hrs: int) -> int:
|
||||
def get_reply_interval_hours(base_dir: str, nickname: str, domain: str,
|
||||
default_reply_interval_hrs: int) -> int:
|
||||
"""Returns the reply interval for the given account.
|
||||
The reply interval is the number of hours after a post being made
|
||||
during which replies are allowed
|
||||
"""
|
||||
replyIntervalFilename = \
|
||||
reply_interval_filename = \
|
||||
acct_dir(base_dir, nickname, domain) + '/.replyIntervalHours'
|
||||
if os.path.isfile(replyIntervalFilename):
|
||||
with open(replyIntervalFilename, 'r') as fp:
|
||||
hoursStr = fp.read()
|
||||
if hoursStr.isdigit():
|
||||
return int(hoursStr)
|
||||
if os.path.isfile(reply_interval_filename):
|
||||
with open(reply_interval_filename, 'r') as interval_file:
|
||||
hours_str = interval_file.read()
|
||||
if hours_str.isdigit():
|
||||
return int(hours_str)
|
||||
return default_reply_interval_hrs
|
||||
|
||||
|
||||
|
@ -1405,17 +1405,17 @@ def setReplyIntervalHours(base_dir: str, nickname: str, domain: str,
|
|||
The reply interval is the number of hours after a post being made
|
||||
during which replies are allowed
|
||||
"""
|
||||
replyIntervalFilename = \
|
||||
reply_interval_filename = \
|
||||
acct_dir(base_dir, nickname, domain) + '/.replyIntervalHours'
|
||||
with open(replyIntervalFilename, 'w+') as fp:
|
||||
with open(reply_interval_filename, 'w+') as interval_file:
|
||||
try:
|
||||
fp.write(str(replyIntervalHours))
|
||||
interval_file.write(str(replyIntervalHours))
|
||||
return True
|
||||
except BaseException:
|
||||
print('EX: setReplyIntervalHours unable to save reply interval ' +
|
||||
str(replyIntervalFilename) + ' ' +
|
||||
except OSError:
|
||||
print('EX: setReplyIntervalHours ' +
|
||||
'unable to save reply interval ' +
|
||||
str(reply_interval_filename) + ' ' +
|
||||
str(replyIntervalHours))
|
||||
pass
|
||||
return False
|
||||
|
||||
|
||||
|
@ -1436,7 +1436,7 @@ def canReplyTo(base_dir: str, nickname: str, domain: str,
|
|||
post_json_object = load_json(post_filename)
|
||||
if not post_json_object:
|
||||
return False
|
||||
published = _getPublishedDate(post_json_object)
|
||||
published = _get_published_date(post_json_object)
|
||||
if not published:
|
||||
return False
|
||||
try:
|
||||
|
|
|
@ -28,7 +28,7 @@ from utils import get_image_formats
|
|||
from utils import acct_dir
|
||||
from utils import get_supported_languages
|
||||
from utils import local_actor_url
|
||||
from utils import getReplyIntervalHours
|
||||
from utils import get_reply_interval_hours
|
||||
from languages import getActorLanguages
|
||||
from skills import getSkills
|
||||
from theme import getThemesList
|
||||
|
@ -2302,8 +2302,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, base_dir: str, path: str,
|
|||
editProfileForm += systemMonitorStr
|
||||
|
||||
# Filtering and blocking section
|
||||
replyIntervalHours = getReplyIntervalHours(base_dir, nickname, domain,
|
||||
default_reply_interval_hrs)
|
||||
replyIntervalHours = get_reply_interval_hours(base_dir, nickname, domain,
|
||||
default_reply_interval_hrs)
|
||||
editProfileForm += \
|
||||
_htmlEditProfileFiltering(base_dir, nickname, domain,
|
||||
user_agents_blocked, translate,
|
||||
|
|
Loading…
Reference in New Issue