Snake case

merge-requests/30/head
Bob Mottram 2021-12-26 12:10:21 +00:00
parent 35f3eaa321
commit 2ae2ce4945
3 changed files with 16 additions and 16 deletions

View File

@ -301,7 +301,7 @@ from utils import loadJson
from utils import saveJson from utils import saveJson
from utils import isSuspended from utils import isSuspended
from utils import dangerousMarkup from utils import dangerousMarkup
from utils import refreshNewswire from utils import refresh_newswire
from utils import isImageFile from utils import isImageFile
from utils import hasGroupType from utils import hasGroupType
from manualapprove import manualDenyFollowRequestThread from manualapprove import manualDenyFollowRequestThread
@ -2502,7 +2502,7 @@ class PubServer(BaseHTTPRequestHandler):
except OSError: except OSError:
print('EX: _personOptions unable to delete ' + print('EX: _personOptions unable to delete ' +
newswireBlockedFilename) newswireBlockedFilename)
refreshNewswire(self.server.base_dir) refresh_newswire(self.server.base_dir)
else: else:
if os.path.isdir(accountDir): if os.path.isdir(accountDir):
nwFilename = newswireBlockedFilename nwFilename = newswireBlockedFilename
@ -2515,7 +2515,7 @@ class PubServer(BaseHTTPRequestHandler):
print('EX: unable to write ' + nwFilename + print('EX: unable to write ' + nwFilename +
' ' + str(ex)) ' ' + str(ex))
if nwWritten: if nwWritten:
refreshNewswire(self.server.base_dir) refresh_newswire(self.server.base_dir)
usersPathStr = \ usersPathStr = \
usersPath + '/' + self.server.defaultTimeline + \ usersPath + '/' + self.server.defaultTimeline + \
'?page=' + str(pageNumber) '?page=' + str(pageNumber)
@ -2548,7 +2548,7 @@ class PubServer(BaseHTTPRequestHandler):
except OSError: except OSError:
print('EX: _personOptions unable to delete ' + print('EX: _personOptions unable to delete ' +
featuresBlockedFilename) featuresBlockedFilename)
refreshNewswire(self.server.base_dir) refresh_newswire(self.server.base_dir)
else: else:
if os.path.isdir(accountDir): if os.path.isdir(accountDir):
featFilename = featuresBlockedFilename featFilename = featuresBlockedFilename
@ -2561,7 +2561,7 @@ class PubServer(BaseHTTPRequestHandler):
print('EX: unable to write ' + featFilename + print('EX: unable to write ' + featFilename +
' ' + str(ex)) ' ' + str(ex))
if featWritten: if featWritten:
refreshNewswire(self.server.base_dir) refresh_newswire(self.server.base_dir)
usersPathStr = \ usersPathStr = \
usersPath + '/' + self.server.defaultTimeline + \ usersPath + '/' + self.server.defaultTimeline + \
'?page=' + str(pageNumber) '?page=' + str(pageNumber)
@ -16729,7 +16729,7 @@ class PubServer(BaseHTTPRequestHandler):
if self._postToOutbox(message_json, if self._postToOutbox(message_json,
self.server.project_version, self.server.project_version,
nickname): nickname):
refreshNewswire(self.server.base_dir) refresh_newswire(self.server.base_dir)
populateReplies(self.server.base_dir, populateReplies(self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain_full, self.server.domain_full,

View File

@ -50,7 +50,7 @@ from utils import loadJson
from utils import saveJson from utils import saveJson
from utils import setConfigParam from utils import setConfigParam
from utils import getConfigParam from utils import getConfigParam
from utils import refreshNewswire from utils import refresh_newswire
from utils import getProtocolPrefixes from utils import getProtocolPrefixes
from utils import hasUsersPath from utils import hasUsersPath
from utils import getImageExtensions from utils import getImageExtensions
@ -1238,7 +1238,7 @@ def removeAccount(base_dir: str, nickname: str,
shutil.rmtree(base_dir + '/sharefilesdeactivated/' + nickname, shutil.rmtree(base_dir + '/sharefilesdeactivated/' + nickname,
ignore_errors=False, onerror=None) ignore_errors=False, onerror=None)
refreshNewswire(base_dir) refresh_newswire(base_dir)
return True return True
@ -1270,7 +1270,7 @@ def deactivateAccount(base_dir: str, nickname: str, domain: str) -> bool:
shutil.move(base_dir + '/sharefiles/' + nickname, shutil.move(base_dir + '/sharefiles/' + nickname,
deactivatedSharefilesDir + '/' + nickname) deactivatedSharefilesDir + '/' + nickname)
refreshNewswire(base_dir) refresh_newswire(base_dir)
return os.path.isdir(deactivatedDir + '/' + nickname + '@' + domain) return os.path.isdir(deactivatedDir + '/' + nickname + '@' + domain)
@ -1298,7 +1298,7 @@ def activateAccount(base_dir: str, nickname: str, domain: str) -> None:
shutil.move(deactivatedSharefilesDir + '/' + nickname, shutil.move(deactivatedSharefilesDir + '/' + nickname,
base_dir + '/sharefiles/' + nickname) base_dir + '/sharefiles/' + nickname)
refreshNewswire(base_dir) refresh_newswire(base_dir)
def isPersonSnoozed(base_dir: str, nickname: str, domain: str, def isPersonSnoozed(base_dir: str, nickname: str, domain: str,

View File

@ -126,18 +126,18 @@ def is_featured_writer(base_dir: str, nickname: str, domain: str) -> bool:
"""Is the given account a featured writer, appearing in the features """Is the given account a featured writer, appearing in the features
timeline on news instances? timeline on news instances?
""" """
featuresBlockedFilename = \ features_blocked_filename = \
acct_dir(base_dir, nickname, domain) + '/.nofeatures' acct_dir(base_dir, nickname, domain) + '/.nofeatures'
return not os.path.isfile(featuresBlockedFilename) return not os.path.isfile(features_blocked_filename)
def refreshNewswire(base_dir: str): def refresh_newswire(base_dir: str):
"""Causes the newswire to be updates after a change to user accounts """Causes the newswire to be updates after a change to user accounts
""" """
refreshNewswireFilename = base_dir + '/accounts/.refresh_newswire' refresh_newswireFilename = base_dir + '/accounts/.refresh_newswire'
if os.path.isfile(refreshNewswireFilename): if os.path.isfile(refresh_newswireFilename):
return return
with open(refreshNewswireFilename, 'w+') as refreshFile: with open(refresh_newswireFilename, 'w+') as refreshFile:
refreshFile.write('\n') refreshFile.write('\n')