Ticket #7676: threadsafe_serializers.diff
File threadsafe_serializers.diff, 1.3 KB (added by , 16 years ago) |
---|
-
django/core/serializers/__init__.py
34 34 35 35 _serializers = {} 36 36 37 def register_serializer( format, serializer_module):37 def register_serializer(serializers, format, serializer_module): 38 38 """Register a new serializer by passing in a module name.""" 39 39 module = __import__(serializer_module, {}, {}, ['']) 40 _serializers[format] = module40 serializers[format] = module 41 41 42 42 def unregister_serializer(format): 43 43 """Unregister a given serializer""" … … 88 88 that user code has a chance to (e.g.) set up custom settings without 89 89 needing to be careful of import order. 90 90 """ 91 global _serializers 92 serializers = {} 91 93 for format in BUILTIN_SERIALIZERS: 92 register_serializer( format, BUILTIN_SERIALIZERS[format])94 register_serializer(serializers, format, BUILTIN_SERIALIZERS[format]) 93 95 if hasattr(settings, "SERIALIZATION_MODULES"): 94 96 for format in settings.SERIALIZATION_MODULES: 95 register_serializer(format, settings.SERIALIZATION_MODULES[format]) 97 register_serializer(serializers, format, 98 settings.SERIALIZATION_MODULES[format]) 99 _serializers = serializers