mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #14823 -- Corrected bootstrapping problems with register_serializers. Thanks to miker985@uw.edu for the report and draft patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15336 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -48,6 +48,8 @@ def register_serializer(format, serializer_module, serializers=None):
|
||||
directly into the global register of serializers. Adding serializers
|
||||
directly is not a thread-safe operation.
|
||||
"""
|
||||
if serializers is None and not _serializers:
|
||||
_load_serializers()
|
||||
module = importlib.import_module(serializer_module)
|
||||
if serializers is None:
|
||||
_serializers[format] = module
|
||||
@@ -56,6 +58,8 @@ def register_serializer(format, serializer_module, serializers=None):
|
||||
|
||||
def unregister_serializer(format):
|
||||
"Unregister a given serializer. This is not a thread-safe operation."
|
||||
if not _serializers:
|
||||
_load_serializers()
|
||||
del _serializers[format]
|
||||
|
||||
def get_serializer(format):
|
||||
|
||||
Reference in New Issue
Block a user