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

View File

@ -50,7 +50,7 @@ from utils import loadJson
from utils import saveJson
from utils import setConfigParam
from utils import getConfigParam
from utils import refreshNewswire
from utils import refresh_newswire
from utils import getProtocolPrefixes
from utils import hasUsersPath
from utils import getImageExtensions
@ -1238,7 +1238,7 @@ def removeAccount(base_dir: str, nickname: str,
shutil.rmtree(base_dir + '/sharefilesdeactivated/' + nickname,
ignore_errors=False, onerror=None)
refreshNewswire(base_dir)
refresh_newswire(base_dir)
return True
@ -1270,7 +1270,7 @@ def deactivateAccount(base_dir: str, nickname: str, domain: str) -> bool:
shutil.move(base_dir + '/sharefiles/' + nickname,
deactivatedSharefilesDir + '/' + nickname)
refreshNewswire(base_dir)
refresh_newswire(base_dir)
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,
base_dir + '/sharefiles/' + nickname)
refreshNewswire(base_dir)
refresh_newswire(base_dir)
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
timeline on news instances?
"""
featuresBlockedFilename = \
features_blocked_filename = \
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
"""
refreshNewswireFilename = base_dir + '/accounts/.refresh_newswire'
if os.path.isfile(refreshNewswireFilename):
refresh_newswireFilename = base_dir + '/accounts/.refresh_newswire'
if os.path.isfile(refresh_newswireFilename):
return
with open(refreshNewswireFilename, 'w+') as refreshFile:
with open(refresh_newswireFilename, 'w+') as refreshFile:
refreshFile.write('\n')