本文整理汇总了Python中django.core.serializers._serializers方法的典型用法代码示例。如果您正苦于以下问题:Python serializers._serializers方法的具体用法?Python serializers._serializers怎么用?Python serializers._serializers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.core.serializers
的用法示例。
在下文中一共展示了serializers._serializers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: clear_serializers_cache
# 需要导入模块: from django.core import serializers [as 别名]
# 或者: from django.core.serializers import _serializers [as 别名]
def clear_serializers_cache(**kwargs):
if kwargs['setting'] == 'SERIALIZATION_MODULES':
from django.core import serializers
serializers._serializers = {}
示例2: setUp
# 需要导入模块: from django.core import serializers [as 别名]
# 或者: from django.core.serializers import _serializers [as 别名]
def setUp(self):
self.old_serializers = serializers._serializers
serializers._serializers = {}
示例3: tearDown
# 需要导入模块: from django.core import serializers [as 别名]
# 或者: from django.core.serializers import _serializers [as 别名]
def tearDown(self):
serializers._serializers = self.old_serializers
示例4: setUpClass
# 需要导入模块: from django.core import serializers [as 别名]
# 或者: from django.core.serializers import _serializers [as 别名]
def setUpClass(cls):
"""Removes imported yaml and stubs importlib.import_module"""
super().setUpClass()
cls._import_module_mock = YamlImportModuleMock()
importlib.import_module = cls._import_module_mock.import_module
# clear out cached serializers to emulate yaml missing
serializers._serializers = {}
示例5: tearDownClass
# 需要导入模块: from django.core import serializers [as 别名]
# 或者: from django.core.serializers import _serializers [as 别名]
def tearDownClass(cls):
"""Puts yaml back if necessary"""
super().tearDownClass()
importlib.import_module = cls._import_module_mock._import_module
# clear out cached serializers to clean out BadSerializer instances
serializers._serializers = {}