mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
b63039ae47
commit
60302e0697
|
@ -14,7 +14,7 @@ from utils import remove_id_ending
|
|||
from utils import has_users_path
|
||||
from utils import get_full_domain
|
||||
from utils import get_status_number
|
||||
from utils import createOutboxDir
|
||||
from utils import create_outbox_dir
|
||||
from utils import urlPermitted
|
||||
from utils import getNicknameFromActor
|
||||
from utils import getDomainFromActor
|
||||
|
@ -157,7 +157,7 @@ def createAnnounce(session, base_dir: str, federation_list: [],
|
|||
if len(ccUrl) > 0:
|
||||
newAnnounce['cc'] = [ccUrl]
|
||||
if saveToFile:
|
||||
outboxDir = createOutboxDir(nickname, domain, base_dir)
|
||||
outboxDir = create_outbox_dir(nickname, domain, base_dir)
|
||||
filename = outboxDir + '/' + newAnnounceId.replace('/', '#') + '.json'
|
||||
save_json(newAnnounce, filename)
|
||||
|
||||
|
|
18
utils.py
18
utils.py
|
@ -777,27 +777,27 @@ def contains_invalid_chars(json_str: str) -> bool:
|
|||
def removeInvalidChars(text: str) -> str:
|
||||
"""Removes any invalid characters from a string
|
||||
"""
|
||||
for isInvalid in INVALID_CHARACTERS:
|
||||
if isInvalid not in text:
|
||||
for is_invalid in INVALID_CHARACTERS:
|
||||
if is_invalid not in text:
|
||||
continue
|
||||
text = text.replace(isInvalid, '')
|
||||
text = text.replace(is_invalid, '')
|
||||
return text
|
||||
|
||||
|
||||
def createPersonDir(nickname: str, domain: str, base_dir: str,
|
||||
dirname: str) -> str:
|
||||
dir_name: str) -> str:
|
||||
"""Create a directory for a person
|
||||
"""
|
||||
handle = nickname + '@' + domain
|
||||
if not os.path.isdir(base_dir + '/accounts/' + handle):
|
||||
os.mkdir(base_dir + '/accounts/' + handle)
|
||||
boxDir = base_dir + '/accounts/' + handle + '/' + dirname
|
||||
if not os.path.isdir(boxDir):
|
||||
os.mkdir(boxDir)
|
||||
return boxDir
|
||||
box_dir = base_dir + '/accounts/' + handle + '/' + dir_name
|
||||
if not os.path.isdir(box_dir):
|
||||
os.mkdir(box_dir)
|
||||
return box_dir
|
||||
|
||||
|
||||
def createOutboxDir(nickname: str, domain: str, base_dir: str) -> str:
|
||||
def create_outbox_dir(nickname: str, domain: str, base_dir: str) -> str:
|
||||
"""Create an outbox for a person
|
||||
"""
|
||||
return createPersonDir(nickname, domain, base_dir, 'outbox')
|
||||
|
|
Loading…
Reference in New Issue