mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
74ee5eeb7e
commit
b8d460b496
|
@ -1138,15 +1138,15 @@ def saveMediaInFormPOST(mediaBytes, debug: bool,
|
|||
|
||||
|
||||
def extractTextFieldsInPOST(postBytes, boundary: str, debug: bool,
|
||||
unitTestData: str = None) -> {}:
|
||||
unit_testData: str = None) -> {}:
|
||||
"""Returns a dictionary containing the text fields of a http form POST
|
||||
The boundary argument comes from the http header
|
||||
"""
|
||||
if not unitTestData:
|
||||
if not unit_testData:
|
||||
msgBytes = email.parser.BytesParser().parsebytes(postBytes)
|
||||
messageFields = msgBytes.get_payload(decode=True).decode('utf-8')
|
||||
else:
|
||||
messageFields = unitTestData
|
||||
messageFields = unit_testData
|
||||
|
||||
if debug:
|
||||
print('DEBUG: POST arriving ' + messageFields)
|
||||
|
|
20
daemon.py
20
daemon.py
|
@ -18283,7 +18283,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
'_POST', 'keyId check',
|
||||
self.server.debug)
|
||||
|
||||
if not self.server.unitTest:
|
||||
if not self.server.unit_test:
|
||||
if not inboxPermittedMessage(self.server.domain,
|
||||
messageJson,
|
||||
self.server.federationList):
|
||||
|
@ -18480,7 +18480,7 @@ def runDaemon(content_license_url: str,
|
|||
domain_max_posts_per_day: int = 8640,
|
||||
account_max_posts_per_day: int = 864,
|
||||
allow_deletion: bool = False,
|
||||
debug: bool = False, unitTest: bool = False,
|
||||
debug: bool = False, unit_test: bool = False,
|
||||
instanceOnlySkillsSearch: bool = False,
|
||||
sendThreads: [] = [],
|
||||
manualFollowerApproval: bool = True) -> None:
|
||||
|
@ -18491,7 +18491,7 @@ def runDaemon(content_license_url: str,
|
|||
print('Invalid domain: ' + domain)
|
||||
return
|
||||
|
||||
if unitTest:
|
||||
if unit_test:
|
||||
serverAddress = (domain, proxy_port)
|
||||
pubHandler = partial(PubServerUnitTest)
|
||||
else:
|
||||
|
@ -18592,9 +18592,9 @@ def runDaemon(content_license_url: str,
|
|||
# list of blocked user agent types within the User-Agent header
|
||||
httpd.user_agents_blocked = user_agents_blocked
|
||||
|
||||
httpd.unitTest = unitTest
|
||||
httpd.unit_test = unit_test
|
||||
httpd.allow_local_network_access = allow_local_network_access
|
||||
if unitTest:
|
||||
if unit_test:
|
||||
# unit tests are run on the local network with LAN addresses
|
||||
httpd.allow_local_network_access = True
|
||||
httpd.yt_replace_domain = yt_replace_domain
|
||||
|
@ -18624,7 +18624,7 @@ def runDaemon(content_license_url: str,
|
|||
# load translations dictionary
|
||||
httpd.translate = {}
|
||||
httpd.systemLanguage = 'en'
|
||||
if not unitTest:
|
||||
if not unit_test:
|
||||
httpd.translate, httpd.systemLanguage = \
|
||||
loadTranslationsFromFile(base_dir, language)
|
||||
if not httpd.systemLanguage:
|
||||
|
@ -18875,7 +18875,7 @@ def runDaemon(content_license_url: str,
|
|||
threadWithTrace(target=runPostsQueue,
|
||||
args=(base_dir, httpd.sendThreads, debug,
|
||||
httpd.send_threads_timeout_mins), daemon=True)
|
||||
if not unitTest:
|
||||
if not unit_test:
|
||||
httpd.thrPostsWatchdog = \
|
||||
threadWithTrace(target=runPostsWatchdog,
|
||||
args=(project_version, httpd), daemon=True)
|
||||
|
@ -18887,7 +18887,7 @@ def runDaemon(content_license_url: str,
|
|||
httpd.thrSharesExpire = \
|
||||
threadWithTrace(target=runSharesExpire,
|
||||
args=(project_version, base_dir), daemon=True)
|
||||
if not unitTest:
|
||||
if not unit_test:
|
||||
httpd.thrSharesExpireWatchdog = \
|
||||
threadWithTrace(target=runSharesExpireWatchdog,
|
||||
args=(project_version, httpd), daemon=True)
|
||||
|
@ -18932,7 +18932,7 @@ def runDaemon(content_license_url: str,
|
|||
account_max_posts_per_day,
|
||||
allow_deletion, debug,
|
||||
max_mentions, max_emoji,
|
||||
httpd.translate, unitTest,
|
||||
httpd.translate, unit_test,
|
||||
httpd.yt_replace_domain,
|
||||
httpd.twitter_replacement_domain,
|
||||
httpd.show_published_date_only,
|
||||
|
@ -18980,7 +18980,7 @@ def runDaemon(content_license_url: str,
|
|||
# this is the instance actor private key
|
||||
httpd.signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
|
||||
|
||||
if not unitTest:
|
||||
if not unit_test:
|
||||
print('Creating inbox queue watchdog')
|
||||
httpd.thrWatchdog = \
|
||||
threadWithTrace(target=runInboxQueueWatchdog,
|
||||
|
|
16
inbox.py
16
inbox.py
|
@ -3187,7 +3187,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
queueFilename: str, destinationFilename: str,
|
||||
max_replies: int, allow_deletion: bool,
|
||||
max_mentions: int, max_emoji: int, translate: {},
|
||||
unitTest: bool,
|
||||
unit_test: bool,
|
||||
yt_replace_domain: str,
|
||||
twitter_replacement_domain: str,
|
||||
show_published_date_only: bool,
|
||||
|
@ -3422,7 +3422,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
# is the sending actor valid?
|
||||
if not validSendingActor(session, base_dir, nickname, domain,
|
||||
personCache, postJsonObject,
|
||||
signingPrivateKeyPem, debug, unitTest):
|
||||
signingPrivateKeyPem, debug, unit_test):
|
||||
return False
|
||||
|
||||
if postJsonObject.get('object'):
|
||||
|
@ -3546,7 +3546,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
nickname, domain, domainFull,
|
||||
postJsonObject, personCache,
|
||||
translate, None, themeName)
|
||||
if not unitTest:
|
||||
if not unit_test:
|
||||
if debug:
|
||||
print('Saving inbox post as html to cache')
|
||||
|
||||
|
@ -3850,7 +3850,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
|||
messageJson: {}, federationList: [],
|
||||
debug: bool, project_version: str,
|
||||
max_followers: int, onion_domain: str,
|
||||
signingPrivateKeyPem: str, unitTest: bool) -> bool:
|
||||
signingPrivateKeyPem: str, unit_test: bool) -> bool:
|
||||
"""Receives a follow request within the POST section of HTTPServer
|
||||
"""
|
||||
if not messageJson['type'].startswith('Follow'):
|
||||
|
@ -3933,7 +3933,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
|||
if not validSendingActor(session, base_dir,
|
||||
nicknameToFollow, domainToFollow,
|
||||
personCache, messageJson,
|
||||
signingPrivateKeyPem, debug, unitTest):
|
||||
signingPrivateKeyPem, debug, unit_test):
|
||||
print('REJECT spam follow request ' + approveHandle)
|
||||
return False
|
||||
|
||||
|
@ -4071,7 +4071,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
|
|||
domain_max_posts_per_day: int,
|
||||
account_max_posts_per_day: int,
|
||||
allow_deletion: bool, debug: bool, max_mentions: int,
|
||||
max_emoji: int, translate: {}, unitTest: bool,
|
||||
max_emoji: int, translate: {}, unit_test: bool,
|
||||
yt_replace_domain: str,
|
||||
twitter_replacement_domain: str,
|
||||
show_published_date_only: bool,
|
||||
|
@ -4373,7 +4373,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
|
|||
federationList,
|
||||
debug, project_version,
|
||||
max_followers, onion_domain,
|
||||
signingPrivateKeyPem, unitTest):
|
||||
signingPrivateKeyPem, unit_test):
|
||||
if os.path.isfile(queueFilename):
|
||||
try:
|
||||
os.remove(queueFilename)
|
||||
|
@ -4502,7 +4502,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
|
|||
queueFilename, destination,
|
||||
max_replies, allow_deletion,
|
||||
max_mentions, max_emoji,
|
||||
translate, unitTest,
|
||||
translate, unit_test,
|
||||
yt_replace_domain,
|
||||
twitter_replacement_domain,
|
||||
show_published_date_only,
|
||||
|
|
|
@ -1657,7 +1657,7 @@ def validSendingActor(session, base_dir: str,
|
|||
personCache: {},
|
||||
postJsonObject: {},
|
||||
signingPrivateKeyPem: str,
|
||||
debug: bool, unitTest: bool) -> bool:
|
||||
debug: bool, unit_test: bool) -> bool:
|
||||
"""When a post arrives in the inbox this is used to check that
|
||||
the sending actor is valid
|
||||
"""
|
||||
|
@ -1689,7 +1689,7 @@ def validSendingActor(session, base_dir: str,
|
|||
print('REJECT: no preferredUsername within actor ' + str(actorJson))
|
||||
return False
|
||||
# does the actor have a bio ?
|
||||
if not unitTest:
|
||||
if not unit_test:
|
||||
bioStr = ''
|
||||
if actorJson.get('summary'):
|
||||
bioStr = removeHtml(actorJson['summary']).strip()
|
||||
|
|
Loading…
Reference in New Issue