1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 06:33:48 +00:00

update timeutils--> remove pytz

This commit is contained in:
r350178982
2025-08-12 16:07:49 +08:00
parent 3250cff196
commit 5441819f33
2 changed files with 1 additions and 10 deletions

View File

@@ -110,7 +110,6 @@ STORAGES = {
},
"staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.ManifestStaticFilesStorage",
# "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
},
}

View File

@@ -1,6 +1,5 @@
# Copyright (c) 2012-2016 Seafile Ltd.
import logging
import pytz
import datetime
from django.conf import settings
import six
@@ -64,7 +63,6 @@ def timestamp_to_isoformat_timestr(timestamp):
return ''
# https://pypi.org/project/pytz/
def datetime_to_isoformat_timestr(datetime):
if not datetime:
@@ -75,15 +73,9 @@ def datetime_to_isoformat_timestr(datetime):
datetime = make_naive(datetime)
try:
# This library only supports two ways of building a localized time.
# The first is to use the localize() method provided by the pytz library.
# This is used to localize a naive datetime (datetime with no timezone information):
datetime = datetime.replace(microsecond=0)
aware_datetime = datetime.replace(tzinfo=current_timezone)
target_timezone = pytz.timezone(str(current_timezone))
localized_datetime = target_timezone.normalize(aware_datetime.astimezone(pytz.UTC))
isoformat_timestr = localized_datetime.isoformat()
isoformat_timestr = aware_datetime.isoformat()
return isoformat_timestr
except Exception as e:
logger.error(e)