mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 00:19:53 +03:00
Use SafeString.represent_str to represent SafeString as str
This commit is contained in:
parent
df92e57ad6
commit
1aad0371e0
|
@ -18,6 +18,7 @@ from django.http.multipartparser import parse_header
|
|||
from django.template import engines, loader
|
||||
from django.urls import NoReverseMatch
|
||||
from django.utils.html import mark_safe
|
||||
from django.utils.safestring import SafeString
|
||||
|
||||
from rest_framework import VERSION, exceptions, serializers, status
|
||||
from rest_framework.compat import (
|
||||
|
@ -1060,6 +1061,7 @@ class OpenAPIRenderer(BaseRenderer):
|
|||
class Dumper(yaml.Dumper):
|
||||
def ignore_aliases(self, data):
|
||||
return True
|
||||
Dumper.add_representer(SafeString, Dumper.represent_str)
|
||||
return yaml.dump(data, default_flow_style=False, sort_keys=False, Dumper=Dumper).encode('utf-8')
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user