diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-07-20 14:22:00 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-07-22 09:29:54 +0200 |
| commit | 3cb2457f46b3e40ff6b6acffcb3fd44cbea091e5 (patch) | |
| tree | 68e43a061f1a7a122c02d5c5b39586b32959a9dc /django/core/serializers | |
| parent | cacd845996d1245f6aed257bff5f748f46206d3f (diff) | |
[py3] Replaced basestring by six.string_types.
Diffstat (limited to 'django/core/serializers')
| -rw-r--r-- | django/core/serializers/base.py | 3 | ||||
| -rw-r--r-- | django/core/serializers/json.py | 3 | ||||
| -rw-r--r-- | django/core/serializers/pyyaml.py | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/django/core/serializers/base.py b/django/core/serializers/base.py index 04053c1f8f..19886f7d53 100644 --- a/django/core/serializers/base.py +++ b/django/core/serializers/base.py @@ -6,6 +6,7 @@ from io import BytesIO from django.db import models from django.utils.encoding import smart_unicode +from django.utils import six class SerializerDoesNotExist(KeyError): """The requested serializer was not found.""" @@ -123,7 +124,7 @@ class Deserializer(object): Init this serializer given a stream or a string """ self.options = options - if isinstance(stream_or_string, basestring): + if isinstance(stream_or_string, six.string_types): self.stream = BytesIO(stream_or_string) else: self.stream = stream_or_string diff --git a/django/core/serializers/json.py b/django/core/serializers/json.py index 941b9e0ba8..8b56d0e7b8 100644 --- a/django/core/serializers/json.py +++ b/django/core/serializers/json.py @@ -13,6 +13,7 @@ from django.core.serializers.base import DeserializationError from django.core.serializers.python import Serializer as PythonSerializer from django.core.serializers.python import Deserializer as PythonDeserializer from django.utils.encoding import smart_str +from django.utils import six from django.utils.timezone import is_aware class Serializer(PythonSerializer): @@ -63,7 +64,7 @@ def Deserializer(stream_or_string, **options): if isinstance(stream_or_string, bytes): stream_or_string = stream_or_string.decode('utf-8') try: - if isinstance(stream_or_string, basestring): + if isinstance(stream_or_string, six.string_types): objects = json.loads(stream_or_string) else: objects = json.load(stream_or_string) diff --git a/django/core/serializers/pyyaml.py b/django/core/serializers/pyyaml.py index 73e92d557f..ac0e6cf82d 100644 --- a/django/core/serializers/pyyaml.py +++ b/django/core/serializers/pyyaml.py @@ -13,6 +13,7 @@ from django.core.serializers.base import DeserializationError from django.core.serializers.python import Serializer as PythonSerializer from django.core.serializers.python import Deserializer as PythonDeserializer from django.utils.encoding import smart_str +from django.utils import six class DjangoSafeDumper(yaml.SafeDumper): @@ -53,7 +54,7 @@ def Deserializer(stream_or_string, **options): """ if isinstance(stream_or_string, bytes): stream_or_string = stream_or_string.decode('utf-8') - if isinstance(stream_or_string, basestring): + if isinstance(stream_or_string, six.string_types): stream = StringIO(stream_or_string) else: stream = stream_or_string |
