Code

Ticket #15889: django_ticket_15889.patch

File django_ticket_15889.patch, 1.0 KB (added by jpic, 3 years ago)
  • django/core/serializers/__init__.py

    diff --git a/django/core/serializers/__init__.py b/django/core/serializers/__init__.py
    index 7afc94c..a9d537f 100644
    a b def unregister_serializer(format): 
    6363    del _serializers[format] 
    6464 
    6565def get_serializer(format): 
     66    if format in get_serializer_formats(): 
     67        raise SerializerNotFound() 
    6668    if not _serializers: 
    6769        _load_serializers() 
    6870    return _serializers[format].Serializer 
  • django/core/serializers/base.py

    diff --git a/django/core/serializers/base.py b/django/core/serializers/base.py
    index cdcc7fa..64fc3d7 100644
    a b from django.db import models 
    88from django.utils.encoding import smart_str, smart_unicode 
    99from django.utils import datetime_safe 
    1010 
     11class SerializerNotFound(Exception): 
     12    """A requested serializer was not found.""" 
     13    pass 
     14 
    1115class SerializationError(Exception): 
    1216    """Something bad happened during serialization.""" 
    1317    pass