# FilteredPluginManager

## Role

Defines the basic mechanisms to have a plugin manager filter the available list of plugins after locating them and before loading them.

One use fo this would be to prevent untrusted plugins from entering the system.

To use it properly you must reimplement or monkey patch the `IsPluginOk` method, as in the following example:

    # define a plugin manager (with you prefered options)
    pm = PluginManager(...)
    # decorate it with the Filtering mechanics
    pm = FilteredPluginManager(pm)
    # define a custom predicate that filters out plugins without descriptions
    pm.isPluginOk = lambda x: x.description!=""

## API

class yapsy.FilteredPluginManager.FilteredPluginManager(decorated_manager=None, categories_filter=None, directories_list=None, plugin_info_ext='yapsy-plugin')

  Base class for decorators which filter the plugins list before they are loaded.

  appendPluginCandidate(pluginTuple)

    Add a new candidate.

  filterPlugins()

    Go through the currently available candidates, and and either leaves them, or moves them into the list of rejected Plugins.

    Can be overridden if overriding `isPluginOk` sentinel is not powerful enough.

  getRejectedPlugins()

    Return the list of rejected plugins.

  isPluginOk(info)

    Sentinel function to detect if a plugin should be filtered.

    `info` is an instance of a `PluginInfo` and this method is expected to return True if the corresponding plugin can be accepted, and False if it must be filtered out.

    Subclasses should override this function and return false for any plugin which they do not want to be loadable.

  locatePlugins()

    locate and filter plugins.

  rejectPluginCandidate(pluginTuple)

    Move a plugin from the candidates list to the rejected List.

  removePluginCandidate(pluginTuple)

    Remove a plugin from the list of candidates.

  unrejectPluginCandidate(pluginTuple)

    Move a plugin from the rejected list to into the candidates list.