mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #6110 -- Mark the python format serializer as for internal use only. Thanks, empty.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6922 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -53,6 +53,11 @@ def get_serializer_formats():
|
||||
_load_serializers()
|
||||
return _serializers.keys()
|
||||
|
||||
def get_public_serializer_formats():
|
||||
if not _serializers:
|
||||
_load_serializers()
|
||||
return [k for k, v in _serializers.iteritems() if not v.Serializer.internal_use_only]
|
||||
|
||||
def get_deserializer(format):
|
||||
if not _serializers:
|
||||
_load_serializers()
|
||||
|
||||
@@ -22,6 +22,10 @@ class Serializer(object):
|
||||
Abstract serializer base class.
|
||||
"""
|
||||
|
||||
# Indicates if the implemented serializer is only available for
|
||||
# internal Django use.
|
||||
internal_use_only = False
|
||||
|
||||
def serialize(self, queryset, **options):
|
||||
"""
|
||||
Serialize a queryset.
|
||||
|
||||
@@ -20,6 +20,8 @@ class Serializer(PythonSerializer):
|
||||
"""
|
||||
Convert a queryset to JSON.
|
||||
"""
|
||||
internal_use_only = False
|
||||
|
||||
def end_serialization(self):
|
||||
self.options.pop('stream', None)
|
||||
self.options.pop('fields', None)
|
||||
|
||||
@@ -13,7 +13,9 @@ class Serializer(base.Serializer):
|
||||
"""
|
||||
Serializes a QuerySet to basic Python objects.
|
||||
"""
|
||||
|
||||
|
||||
internal_use_only = True
|
||||
|
||||
def start_serialization(self):
|
||||
self._current = None
|
||||
self.objects = []
|
||||
|
||||
@@ -19,6 +19,8 @@ class Serializer(PythonSerializer):
|
||||
Convert a queryset to YAML.
|
||||
"""
|
||||
|
||||
internal_use_only = False
|
||||
|
||||
def handle_field(self, obj, field):
|
||||
# A nasty special case: base YAML doesn't support serialization of time
|
||||
# types (as opposed to dates or datetimes, which it does support). Since
|
||||
|
||||
Reference in New Issue
Block a user