diff --git a/shares.py b/shares.py index 5847f1b8f..d55ea0a34 100644 --- a/shares.py +++ b/shares.py @@ -24,7 +24,7 @@ from session import postImage from session import createSession from utils import has_object_stringType from utils import dateStringToSeconds -from utils import dateSecondsToString +from utils import date_seconds_to_string from utils import get_config_param from utils import get_full_domain from utils import validNickname @@ -1314,8 +1314,8 @@ def sharesCatalogEndpoint(base_dir: str, http_prefix: str, if not re.match(matchPattern, description): continue - startDateStr = dateSecondsToString(item['published']) - expireDateStr = dateSecondsToString(item['expire']) + startDateStr = date_seconds_to_string(item['published']) + expireDateStr = date_seconds_to_string(item['expire']) shareId = _getValidSharedItemID(owner, item['displayName']) if item['dfcId'].startswith('epicyon#'): dfcId = "epicyon:" + item['dfcId'].split('#')[1] diff --git a/tests.py b/tests.py index 10620d064..294626bd0 100644 --- a/tests.py +++ b/tests.py @@ -64,7 +64,7 @@ from utils import get_supported_languages from utils import setConfigParam from utils import is_group_actor from utils import dateStringToSeconds -from utils import dateSecondsToString +from utils import date_seconds_to_string from utils import validPassword from utils import userAgentDomain from utils import camelCaseSplit @@ -5675,7 +5675,7 @@ def _testDateConversions() -> None: print('testDateConversions') dateStr = "2021-05-16T14:37:41Z" dateSec = dateStringToSeconds(dateStr) - dateStr2 = dateSecondsToString(dateSec) + dateStr2 = date_seconds_to_string(dateSec) assert dateStr == dateStr2 diff --git a/utils.py b/utils.py index 85e56e61b..aa8921816 100644 --- a/utils.py +++ b/utils.py @@ -2981,11 +2981,11 @@ def dateStringToSeconds(dateStr: str) -> int: return int(datetime.datetime.timestamp(expiryTime)) -def dateSecondsToString(dateSec: int) -> str: +def date_seconds_to_string(date_sec: int) -> str: """Converts a date in seconds since epoch to a string """ - thisDate = datetime.datetime.fromtimestamp(dateSec) - return thisDate.strftime("%Y-%m-%dT%H:%M:%SZ") + this_date = datetime.datetime.fromtimestamp(date_sec) + return this_date.strftime("%Y-%m-%dT%H:%M:%SZ") def has_group_type(base_dir: str, actor: str, person_cache: {},