update
This commit is contained in:
@@ -17,15 +17,6 @@ from rest_framework.views import APIView
|
||||
|
||||
from .app_settings import swagger_settings
|
||||
|
||||
try:
|
||||
import zoneinfo
|
||||
except ImportError:
|
||||
try:
|
||||
from backports import zoneinfo
|
||||
except ImportError:
|
||||
zoneinfo = None
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -451,7 +442,7 @@ def force_real_str(s, encoding='utf-8', strings_only=False, errors='strict'):
|
||||
"""
|
||||
if s is not None:
|
||||
s = force_str(s, encoding, strings_only, errors)
|
||||
if type(s) is not str:
|
||||
if type(s) != str:
|
||||
s = '' + s
|
||||
|
||||
# Remove common indentation to get the correct Markdown rendering
|
||||
@@ -474,10 +465,7 @@ def field_value_to_representation(field, value):
|
||||
else:
|
||||
value = str(value)
|
||||
|
||||
elif isinstance(value, pytz.BaseTzInfo):
|
||||
value = str(value)
|
||||
|
||||
elif zoneinfo is not None and isinstance(value, zoneinfo.ZoneInfo):
|
||||
if isinstance(value, pytz.BaseTzInfo):
|
||||
value = str(value)
|
||||
|
||||
# JSON roundtrip ensures that the value is valid JSON;
|
||||
|
||||
Reference in New Issue
Block a user