Example #1
0
def __register_all_app_blueprints(flaskapp):
    from core.helpers import import_submodules
    import interfaces
    imported_apps = import_submodules(interfaces)
    for interface_name, interfaces_module in imported_apps.items():
        try:
            display_blueprints = []
            for submodule in import_submodules(interfaces_module,
                                               recursive=True).values():
                display_blueprints.extend(
                    __get_blueprints_in_module(submodule))
        except ImportError:
            pass
        else:
            __register_app_blueprints(flaskapp, interface_name,
                                      display_blueprints)
Example #2
0
def __register_all_app_blueprints(flaskapp):
    from core.helpers import import_submodules
    import apps
    imported_apps = import_submodules(apps)
    for app_name, app_module in imported_apps.items():
        try:
            blueprints = __get_blueprints_in_module(app_module)
        except ImportError:
            continue
        else:
            url_prefix = '/apps/{0}'.format(app_name.split('.')[-1])
            for blueprint in blueprints:
                __register_app_blueprint(flaskapp, blueprint, url_prefix)

            __register_all_app_widget_blueprints(flaskapp, app_module)
Example #3
0
def __register_all_app_widget_blueprints(app_module):
    from importlib import import_module
    from core.helpers import import_submodules
    try:
        widgets_module = import_module('{0}.widgets'.format(app_module.__name__))
    except ImportError:
        return
    else:
        app_name = app_module.__name__.split('.')[-1]
        imported_widgets = import_submodules(widgets_module)
        for widget_name, widget_module in imported_widgets.items():
            try:
                blueprints = __get_blueprints_in_module(widget_module)
            except ImportError:
                continue
            else:
                url_prefix = '/apps/{0}/{1}'.format(app_name, widget_name.split('.')[-1])
                for blueprint in blueprints:
                    __register_app_blueprint(blueprint, url_prefix)
Example #4
0
def __register_all_app_blueprints(flaskapp):
    from core.helpers import import_submodules
    import apps
    imported_apps = import_submodules(apps)
    for app_name, app_module in imported_apps.items():
        try:
            display_blueprints = __get_blueprints_in_module(app_module)
        except ImportError:
            pass
        else:
            __register_app_blueprints(flaskapp, app_name, display_blueprints)

        try:
            blueprints = __get_blueprints_in_module(app_module, sub_module_name='events')
        except ImportError:
            pass
        else:
            __register_app_blueprints(flaskapp, app_name, blueprints)

        __register_all_app_widget_blueprints(flaskapp, app_module)