mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #8193: all dynamic imports in Django are now done correctly. I know this because Brett Cannon borrowed the time machine and brought Python 2.7's 'importlib back for inclusion in Django. Thanks for the patch-from-the-future, Brett!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10088 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -17,6 +17,7 @@ To add your own serializers, use the SERIALIZATION_MODULES setting::
|
||||
"""
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils import importlib
|
||||
|
||||
# Built-in serializers
|
||||
BUILTIN_SERIALIZERS = {
|
||||
@@ -47,7 +48,7 @@ def register_serializer(format, serializer_module, serializers=None):
|
||||
directly into the global register of serializers. Adding serializers
|
||||
directly is not a thread-safe operation.
|
||||
"""
|
||||
module = __import__(serializer_module, {}, {}, [''])
|
||||
module = importlib.import_module(serializer_module)
|
||||
if serializers is None:
|
||||
_serializers[format] = module
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user