web.pluginmanager.pluginmanager.PluginManager

Package web :: Package pluginmanager :: Module pluginmanager :: Class PluginManager |
[hide private]
[frames] | no frames]

# Class PluginManager

source code

Instance Methods | [hide private]
__init__(self) | source code
enable_plugin(self, name) Enables a plugin if all the deps are met. | source code
disable_plugin(self, name) Disables a plugin and all plugins that have given plugin as a dependency. | source code
uninstall_plugin(self, name, delete_files) Uninstall the given plugin. | source code
check_for_new_plugins(self) Look for new instances in plugins' directory and add to self.plugins. | source code
get_plugin_by_name(self, name) Return the instance of the plugin whose name is given. | source code
get_enabled_plugins(self) Return a instance list of the enabled plugins. | source code
__enable_plugin(self, plugin) Enable a plugin without verify the dependencies. | source code
__install_plugin(self, plugin) Called only by __enable_plugin when a plugin has not been installed before. | source code
__disable_plugin(self, plugin) Disable a plugin without verify the dependencies. | source code
__get_dependencies(self, plugin, checked_deps=None, checked_plugins=None) Recursively returns the list of the dependencies of the given plugins. | source code
__get_reverse_dependencies(self, plugin, checked_deps=None, checked_plugins=None) Recursively returns the list of the reverse dependencies of the given plugins. | source code
__instance_plugin(self, name) | source code
__get_plugins_directories(self) Return the list of the directories of plugins that there are in the plugins directory. | source code

Method Details | [hide private]

### enable_plugin(self, name) | source code
Enables a plugin if all the deps are met. Else it raises UnmetDependencyException. Returns the list of enabled plugins. In this case, enable means this plugins will be enabled in the future: this function will only be called when the user enables a plugin in the pluginmanager.PluginListView.

### disable_plugin(self, name) | source code
Disables a plugin and all plugins that have given plugin as a dependency. Returns the list of disabled plugins. In this case, disable means this plugins will be disabled in the future: this function will only be called when the user disables a plugin in the pluginmanager.PluginListView.

### uninstall_plugin(self, name, delete_files) | source code
    Uninstall the given plugin. There are two ways of uninstall:
      * When delete_files is false, then this function only deletes
      all plugin's data in the db. In this way you can reinstall the
      plugin when you want.
      * When delete_files is true, then this function delete all plugin's
      data in the db and plugin's directory. In this way all data is
      deleted, so you have to get the whole plugin to reinstall.

    Either way, this function always removes the installed files in static/
    and templates/ for this plugin.

    Before uninstalling a plugin, it MUST be disabled and obviously all
    the plugins that have the plugin as a dependency.

### get_plugin_by_name(self, name) | source code
Return the instance of the plugin whose name is given. None is returned if the instance is not found.

### __install_plugin(self, plugin) | source code
    Called only by __enable_plugin when a plugin has not been installed before.

    * Creates the tables in the database from the plugin model
    * installs the static/ and templates/ plugin directories in
      static/plugins/<pluginname> and templates/plugins/<pluginname>/
    * calls to the install() function of the given plugin

### __get_dependencies(self, plugin, checked_deps=None, checked_plugins=None) | source code
Recursively returns the list of the dependencies of the given plugins. If any of the dependencies is not met then it will raise a UnMetDependencyException. The list of plugins dependencies will include the plugin itself which will be at the end of the list, and the list of dependencies will be ordered in such a way that they can be safely activated one by one, because any of the listed plugins will be preceded by its dependencies. It will only be called by enable_plugin().

### __get_reverse_dependencies(self, plugin, checked_deps=None, checked_plugins=None) | source code
Recursively returns the list of the reverse dependencies of the given plugins. The list of plugins dependencies will include the plugin itself which will be at the end of the list, and the list of dependencies will be ordered in such a way that they can be safely desactivated one by one, because any of the listed plugins will be preceded by its dependencies. It will only be called by disable_plugin().