Example #1
0
def _load():
    """Imports the files from the plugins directories and loads templates."""
    from infogami.utils import macro, template
    global plugins

    plugins = [_make_plugin('core')]

    if config.plugins is not None:
        plugins += [_make_plugin(p) for p in config.plugins]
    else:
        for p in config.plugin_path:
            m = __import__(p)
            root = os.path.dirname(m)
            plugins += _list_plugins(root)

    if config.plugin_modules is not None:
        plugins += [
            _make_plugin_module(name) for name in config.plugin_modules
        ]

    for plugin in plugins:
        template.load_templates(plugin.path, lazy=True)
        macro.load_macros(plugin.path, lazy=True)
        i18n.load_strings(plugin.path)
        __import__(plugin.module + '.code', globals(), locals(), ['plugins'])

    features.set_feature_flags(config.get("features", {}))
Example #2
0
def setup():
    setup_logging()

    logger = logging.getLogger("openlibrary")
    logger.info("Application init")

    for p in old_plugins:
        logger.info("loading plugin %s", p)
        modname = "openlibrary.plugins.%s.code" % p
        path = "openlibrary/plugins/" + p
        template.load_templates(path, lazy=True)
        macro.load_macros(path, lazy=True)
        i18n.load_strings(path)
        __import__(modname, globals(), locals(), ['plugins'])

    delegate.plugins += [
        delegate._make_plugin_module('openlibrary.plugins.' + name)
        for name in old_plugins
    ]

    load_views()

    # load actions
    from . import actions

    logger.info("loading complete.")
Example #3
0
def setup():
    for p in old_plugins:
        modname = "openlibrary.plugins.%s.code" % p
        print "loading", p, modname
        path = "openlibrary/plugins/" + p
        template.load_templates(path, lazy=True)
        macro.load_macros(path, lazy=True)
        i18n.load_strings(path)
        __import__(modname, globals(), locals(), ['plugins'])
Example #4
0
def setup():
    setup_logging()

    logger = logging.getLogger("openlibrary")
    logger.info("Application init")

    for p in old_plugins:
        logger.info("loading plugin %s", p)
        modname = "openlibrary.plugins.%s.code" % p
        path = "openlibrary/plugins/" + p
        template.load_templates(path, lazy=True)
        macro.load_macros(path, lazy=True)
        i18n.load_strings(path)
        __import__(modname, globals(), locals(), ['plugins'])

    load_views()

    # load actions
    from . import actions

    logger.info("loading complete.")