Python django.core.serializers 模块,SerializerDoesNotExist() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用django.core.serializers.SerializerDoesNotExist()

项目:django-gitversions    作者:michaelkuty    | 项目源码 | 文件源码
def create_serializer(cls, format):
        '''create instance of serializer from two classes'''

        try:
            FormatSerializerCls = serializers.get_serializer(format)
        except serializers.SerializerDoesNotExist:
            raise Exception("Unknown serialization format: %s" % format)

        SerializerCls = type('GitVersionSerializer', (
            cls, FormatSerializerCls), {})

        return SerializerCls()