merge-requests/30/head
Bob Mottram 2022-12-18 13:58:48 +00:00
parent 9d2c831c15
commit 2da3b42314
3 changed files with 6 additions and 5 deletions

View File

@ -8,6 +8,7 @@ __status__ = "Production"
__module_group__ = "Calendar" __module_group__ = "Calendar"
import os import os
from utils import acct_dir
def _text_in_file2(text: str, filename: str, def _text_in_file2(text: str, filename: str,
@ -32,7 +33,7 @@ def _text_in_file2(text: str, filename: str,
def _dir_acct(base_dir: str, nickname: str, domain: str) -> str: def _dir_acct(base_dir: str, nickname: str, domain: str) -> str:
"""Returns the directory of an account """Returns the directory of an account
""" """
return base_dir + '/accounts/' + nickname + '@' + domain return acct_dir(base_dir, nickname, domain)
def _port_domain_remove(domain: str) -> str: def _port_domain_remove(domain: str) -> str:

View File

@ -3816,7 +3816,7 @@ def get_account_timezone(base_dir: str, nickname: str, domain: str) -> str:
"""Returns the timezone for the given account """Returns the timezone for the given account
""" """
tz_filename = \ tz_filename = \
base_dir + '/accounts/' + nickname + '@' + domain + '/timezone.txt' acct_dir(base_dir, nickname, domain) + '/timezone.txt'
if not os.path.isfile(tz_filename): if not os.path.isfile(tz_filename):
return None return None
timezone = None timezone = None
@ -3830,7 +3830,7 @@ def set_account_timezone(base_dir: str, nickname: str, domain: str,
"""Sets the timezone for the given account """Sets the timezone for the given account
""" """
tz_filename = \ tz_filename = \
base_dir + '/accounts/' + nickname + '@' + domain + '/timezone.txt' acct_dir(base_dir, nickname, domain) + '/timezone.txt'
timezone = timezone.strip() timezone = timezone.strip()
with open(tz_filename, 'w+', encoding='utf-8') as fp_timezone: with open(tz_filename, 'w+', encoding='utf-8') as fp_timezone:
fp_timezone.write(timezone) fp_timezone.write(timezone)

View File

@ -2158,9 +2158,9 @@ def _html_edit_notifications(base_dir: str, nickname: str, domain: str,
ntfy_topic = '' ntfy_topic = ''
ntfy_url_file = \ ntfy_url_file = \
base_dir + '/accounts/' + nickname + '@' + domain + '/.ntfy_url' acct_dir(base_dir, nickname, domain) + '/.ntfy_url'
ntfy_topic_file = \ ntfy_topic_file = \
base_dir + '/accounts/' + nickname + '@' + domain + '/.ntfy_topic' acct_dir(base_dir, nickname, domain) + '/.ntfy_topic'
if os.path.isfile(ntfy_url_file): if os.path.isfile(ntfy_url_file):
try: try:
with open(ntfy_url_file, 'r', encoding='utf-8') as fp_ntfy: with open(ntfy_url_file, 'r', encoding='utf-8') as fp_ntfy: