Snake case

merge-requests/30/head
Bob Mottram 2021-12-27 18:28:26 +00:00
parent 022ecf1eb8
commit 8988485391
4 changed files with 12 additions and 12 deletions

View File

@ -14,7 +14,7 @@ from utils import get_full_domain
from utils import urlPermitted from utils import urlPermitted
from utils import getDomainFromActor from utils import getDomainFromActor
from utils import getNicknameFromActor from utils import getNicknameFromActor
from utils import domainPermitted from utils import domain_permitted
from utils import follow_person from utils import follow_person
from utils import acct_dir from utils import acct_dir
from utils import has_group_type from utils import has_group_type
@ -201,7 +201,7 @@ def receiveAcceptReject(session, base_dir: str,
print('DEBUG: "users" or "profile" missing from actor in ' + print('DEBUG: "users" or "profile" missing from actor in ' +
message_json['type'] + '. Assuming single user instance.') message_json['type'] + '. Assuming single user instance.')
domain, _ = getDomainFromActor(message_json['actor']) domain, _ = getDomainFromActor(message_json['actor'])
if not domainPermitted(domain, federation_list): if not domain_permitted(domain, federation_list):
if debug: if debug:
print('DEBUG: ' + message_json['type'] + print('DEBUG: ' + message_json['type'] +
' from domain not permitted - ' + domain) ' from domain not permitted - ' + domain)

View File

@ -16,7 +16,7 @@ from utils import has_users_path
from utils import get_full_domain from utils import get_full_domain
from utils import get_followers_list from utils import get_followers_list
from utils import validNickname from utils import validNickname
from utils import domainPermitted from utils import domain_permitted
from utils import getDomainFromActor from utils import getDomainFromActor
from utils import getNicknameFromActor from utils import getNicknameFromActor
from utils import get_status_number from utils import get_status_number
@ -860,7 +860,7 @@ def sendFollowRequest(session, base_dir: str,
if not signing_priv_key_pem: if not signing_priv_key_pem:
print('WARN: follow request without signing key') print('WARN: follow request without signing key')
if not domainPermitted(followDomain, federation_list): if not domain_permitted(followDomain, federation_list):
print('You are not permitted to follow the domain ' + followDomain) print('You are not permitted to follow the domain ' + followDomain)
return None return None

View File

@ -17,7 +17,7 @@ from languages import understoodPostLanguage
from like import updateLikesCollection from like import updateLikesCollection
from reaction import updateReactionCollection from reaction import updateReactionCollection
from reaction import validEmojiContent from reaction import validEmojiContent
from utils import domainPermitted from utils import domain_permitted
from utils import is_group_account from utils import is_group_account
from utils import is_system_account from utils import is_system_account
from utils import invalid_ciphertext from utils import invalid_ciphertext
@ -3881,7 +3881,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
domain_full = get_full_domain(domain, tempPort) domain_full = get_full_domain(domain, tempPort)
if tempPort: if tempPort:
fromPort = tempPort fromPort = tempPort
if not domainPermitted(domain, federation_list): if not domain_permitted(domain, federation_list):
if debug: if debug:
print('DEBUG: follower from domain not permitted - ' + domain) print('DEBUG: follower from domain not permitted - ' + domain)
return False return False
@ -3900,7 +3900,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
'not found within object') 'not found within object')
return False return False
domainToFollow, tempPort = getDomainFromActor(message_json['object']) domainToFollow, tempPort = getDomainFromActor(message_json['object'])
if not domainPermitted(domainToFollow, federation_list): if not domain_permitted(domainToFollow, federation_list):
if debug: if debug:
print('DEBUG: follow domain not permitted ' + domainToFollow) print('DEBUG: follow domain not permitted ' + domainToFollow)
return True return True

View File

@ -809,7 +809,7 @@ def create_inbox_queue_dir(nickname: str, domain: str, base_dir: str) -> str:
return createPersonDir(nickname, domain, base_dir, 'queue') return createPersonDir(nickname, domain, base_dir, 'queue')
def domainPermitted(domain: str, federation_list: []): def domain_permitted(domain: str, federation_list: []):
if len(federation_list) == 0: if len(federation_list) == 0:
return True return True
domain = remove_domain_port(domain) domain = remove_domain_port(domain)
@ -1126,8 +1126,8 @@ def _setDefaultPetName(base_dir: str, nickname: str, domain: str,
# petname already exists # petname already exists
return return
# petname doesn't already exist # petname doesn't already exist
with open(petnamesFilename, 'a+') as petnamesFile: with open(petnamesFilename, 'a+') as petnames_file:
petnamesFile.write(petnameLookupEntry) petnames_file.write(petnameLookupEntry)
def follow_person(base_dir: str, nickname: str, domain: str, def follow_person(base_dir: str, nickname: str, domain: str,
@ -1138,8 +1138,8 @@ def follow_person(base_dir: str, nickname: str, domain: str,
"""Adds a person to the follow list """Adds a person to the follow list
""" """
followDomainStrLower = followDomain.lower().replace('\n', '') followDomainStrLower = followDomain.lower().replace('\n', '')
if not domainPermitted(followDomainStrLower, if not domain_permitted(followDomainStrLower,
federation_list): federation_list):
if debug: if debug:
print('DEBUG: follow of domain ' + print('DEBUG: follow of domain ' +
followDomain + ' not permitted') followDomain + ' not permitted')