def load_plugins(app): from datacat.utils.plugin_manager import PluginManager plugins = [] for name in app.config['PLUGINS']: # Instantiate plugin class plugin = import_object(name) plugin._import_name = name plugins.append(plugin) # Setup the plugin plugin.setup(app) return PluginManager(plugins)
def get_resource_accessors(): """ Get a dictionary mapping URL scheme names to accessor class for URLs with that scheme. The map will be taken from the ``RESOURCE_ACCESSORS`` setting; accessors referenced by name will be replaced with the actual class. """ accessors = current_app.config['RESOURCE_ACCESSORS'] _accessors = {} for key, val in accessors.iteritems(): if isinstance(val, basestring): val = import_object(val) _accessors[key] = val return _accessors