Python rest_framework.viewsets.ViewSetMixin() Examples

The following are 1 code examples of rest_framework.viewsets.ViewSetMixin(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module rest_framework.viewsets , or try the search function .
Example #1
Source File: view.py    From py2swagger with MIT License 6 votes vote down vote up
def get_view_introspector(api):
    """
    Creates view introspector based on api

    :param api:
    :rtype: BaseViewIntrospector
    """
    callback = api['callback']

    def inmodule(callback, module_name):
        return callback.__module__ == module_name

    map = (
        (issubclass, ViewSetMixin, ViewSetIntrospector),
        (inmodule, 'rest_framework.decorators', WrappedApiViewIntrospector),
        (issubclass, APIView, ApiViewIntrospector),
    )

    for f, param, introspector_class in map:
        if f(callback, param):
            return introspector_class(**api)

    raise IntrospectorException('View introspector not recognized')