How to use the fair.view_old.CView.__subclasses__ function in fair

To help you get started, we’ve selected a few fair examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github remyzane / fair-api / fair / configure_old.py View on Github external
"""Configure view

    url route configure.

    :param app: Flask app object
    :param config: view's config
    :type  config: dict
    """
    from .view_old import CView

    if not view_packages:
        return
    for package_path in view_packages:
        iterate_package(import_module(package_path))

    for view in CView.__subclasses__():
        name = class_name_to_api_name(view.__name__)
        uri = '/%s/%s' % (view.__module__.split('.')[0], name)
        endpoint = '%s.%s' % (view.__module__.split('.')[0], name)
        app.add_url_rule(uri, view_func=view.as_view(endpoint, uri, app))