plugin_utils — PyCI Plugin Utility Module

class Plugin

The base class from which all plugins are derived. Contains functions that are both required and just plain useful when writing plugins.

Note: If you’re going to override the __init__() function of Plugin make sure to include ‘super(YourPlugin, self).__init__()’ in your plugin’s __init__(). Otherwise your plugin will likely have problems with internationalization.

debug_helper(*args, **kwargs)
Return a page with all the arguments we were passed (for debugging)
standard_render(template, **kwargs)
Renders mako ‘template’ with the standard variables
detect_mime_type(filepath)
Attempts to detect the mime type of the given file and sets the appropriate cherrypy response header
find_plugins()
Returns a list containing all active plugin objects
get_display_plugins()
Returns a list of plugins that have the display variable set
get_plugins(plugin_dir)
Adds plugins to sys.path and returns them as a list
get_translation(plugin_file)
Returns a gettext translation object with the specified domain and locale_dir. @plugin_file: The calling plugin’s __file__ variable.
get_user_plugins(user)
Returns a list of plugins with the display variable set that the given user has at least read access to. In other words, it will only lists plugins the user is supposed to see.
init_plugin_system(cfg)

Initializes the plugin system by appending all plugins into sys.path and then using load_plugins() to import them.

@cfg - A dictionary with two keys:
@plugin_path - path to the plugin directory (e.g. ‘plugins_enabled’) @plugins - List of plugin names to import (e.g. [‘admin’, ‘network’, ‘status’].
load_plugins(plugins)
Imports all plugins given a list. Note: Assumes they’re all in sys.path.

Previous topic

passwd — PyCI /etc/passwd Module

Next topic

pcyi_db — PyCI DB Module

This Page

Quick search