Loading django/core/serializers/pyyaml.py +9 −2 Original line number Diff line number Diff line Loading @@ -14,8 +14,15 @@ from django.core.serializers.python import Serializer as PythonSerializer from django.core.serializers.python import Deserializer as PythonDeserializer from django.utils import six # Use the C (faster) implementation if possible try: from yaml import CSafeLoader as SafeLoader from yaml import CSafeDumper as SafeDumper except ImportError: from yaml import SafeLoader, SafeDumper class DjangoSafeDumper(yaml.SafeDumper): class DjangoSafeDumper(SafeDumper): def represent_decimal(self, data): return self.represent_scalar('tag:yaml.org,2002:str', str(data)) Loading Loading @@ -58,7 +65,7 @@ def Deserializer(stream_or_string, **options): else: stream = stream_or_string try: for obj in PythonDeserializer(yaml.safe_load(stream), **options): for obj in PythonDeserializer(yaml.load(stream, Loader=SafeLoader), **options): yield obj except GeneratorExit: raise Loading Loading
django/core/serializers/pyyaml.py +9 −2 Original line number Diff line number Diff line Loading @@ -14,8 +14,15 @@ from django.core.serializers.python import Serializer as PythonSerializer from django.core.serializers.python import Deserializer as PythonDeserializer from django.utils import six # Use the C (faster) implementation if possible try: from yaml import CSafeLoader as SafeLoader from yaml import CSafeDumper as SafeDumper except ImportError: from yaml import SafeLoader, SafeDumper class DjangoSafeDumper(yaml.SafeDumper): class DjangoSafeDumper(SafeDumper): def represent_decimal(self, data): return self.represent_scalar('tag:yaml.org,2002:str', str(data)) Loading Loading @@ -58,7 +65,7 @@ def Deserializer(stream_or_string, **options): else: stream = stream_or_string try: for obj in PythonDeserializer(yaml.safe_load(stream), **options): for obj in PythonDeserializer(yaml.load(stream, Loader=SafeLoader), **options): yield obj except GeneratorExit: raise Loading