Ticket #18457: 18457.diff

File 18457.diff, 881 bytes (added by Jonathan Paugh, 12 years ago)
  • django/core/serializers/pyyaml.py

    diff --git a/django/core/serializers/pyyaml.py b/django/core/serializers/pyyaml.py
    index 5effda5..b983c75 100644
    a b Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.  
    66
    77import decimal
    88import yaml
    9 from io import BytesIO
     9from io import BytesIO, StringIO
    1010
    1111from django.db import models
    1212from django.core.serializers.base import DeserializationError
    def Deserializer(stream_or_string, **options):  
    4848    """
    4949    Deserialize a stream or string of YAML data.
    5050    """
    51     if isinstance(stream_or_string, basestring):
     51    if isinstance(stream_or_string, str):
    5252        stream = BytesIO(stream_or_string)
     53    elif isinstance(stream_or_string, unicode):
     54        stream = StringIO(stream_or_string)
    5355    else:
    5456        stream = stream_or_string
    5557    try:
Back to Top