web.pluginmanager.plugins.pluginbase.PluginBase

Package web :: Package pluginmanager :: Package plugins :: Module pluginbase :: Class PluginBase |
[hide private]
[frames] | no frames]

# Class PluginBase

source code

    object --+
             |
            PluginBase

Plugin base class. Each plugin should inherit from this class.

Variables documentation:

urls: This variable is a tuple of pairs in the form "url-regexp, view" as in web.py applications, but for this plugin only.

Instance Methods | [hide private]
__init__(self) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code
get_dependencies(self) Returns the depencies list. | source code
set_dependencies(self, depstr) Generates the dependencies given a string. | source code
get_version(self) Returns the version. | source code
set_version(self, verstr) Generates the version given a string. | source code
is_enabled(self) Returns if the plugin is enabled in exection time. | source code
read_config(self, name) Parses plugin conf file and sets all values as object attributes. | source code
read_config_path(self, path) Given a path, it generates the initial configuration of a plugin. | source code
get_actions(self) Returns the actions. | source code
get_main_panel_actions(self) Returns the actions which appears in the main panel | source code
enable(self) This function initialize the plugin in such a way that it can used. | source code
disable(self) This function will be called when the plugin is enabled and it's going to be disabled by the admins of the aplication. | source code
install(self) This function will be called when the plugin is enabled the first time. | source code
uninstall(self) This function will be called when the user wants to delete the plugin from the system. | source code
_request(self, args, method) Request a GET or a POST petition to the plugin. | source code
get_options(self) This function has to return a form. | source code
save_options(self, inputs) This function is called when the user filles the form returned by get_options, which is passed like argument. | source code
get_actions_for_ou(self, ou) When the user navigates the organizative units tree structure it will a panel with plugins' actions. | source code
get_actions_for_computer(self, computer) The same that get_actions_for_ou but when the user is seing only a computer. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables | [hide private]
| depend = `property(get_dependencies, set_dependencies)`
| version = `property(get_version, set_version)`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self) (Constructor) | source code
x.__init__(...) initializes x; see x.__class__.__doc__ for signature Overrides: object.__init__ (inherited documentation)

### set_dependencies(self, depstr) | source code
Generates the dependencies given a string. It's necesary for parsing the configuration file.

### set_version(self, verstr) | source code
Generates the version given a string. It's necesary for parsing the configuration file.

### enable(self) | source code
    This function initialize the plugin in such a way that it can used.
    It will be called in two cases:
    1.  When the plugin is disabled and it's going to be enabled by the
        admins of the aplication. In this case the install function will
        also be called if the plugin has not previously been
        installed.
    2.  Once the plugin is already enabled and installed the pluginmanager
        will instanciate the plugin and then will call this enable
        function. This is because the enable function will always before
        the plugin can be used.

    You can reimplement this function if you want to execute custom
    actions when your plugin is going to be used.

### disable(self) | source code
This function will be called when the plugin is enabled and it's going to be disabled by the admins of the aplication. It is called only by the pluginmanager. WARNING: Note that disable will NOT be called when the application shutdowns. Use __del__ for that. You can reimplement this function if you want to execute custom actions when your plugin is going to be disabled.

### install(self) | source code
This function will be called when the plugin is enabled the first time. You can reimplement this function if you want to install some tables in the data base, or to do something only once.

### uninstall(self) | source code
This function will be called when the user wants to delete the plugin from the system. You can reimplement this function like a cleanup function. You MUST erase all data that plugin generated when it's not goint to be used ever. For example all tables in the data base or data generated in install function.

### _request(self, args, method) | source code
Request a GET or a POST petition to the plugin. Redirects a url to a view inside the plugin and returns the data that the appropiate view returns. The "method" argument can be either "GET" or "POST". This function is ONLY called by PluginView. When a request of type /plugin/<plugin_name>/<args> is received, PluginView deals with it and acts as a proxy, calling to this _request function of the plugin called "plugin_name", with args= "args". Each plugin deals with GET and POST requests by configuring the self.url tuple of pairs url-regexp, view, as webpy applications do.

### get_options(self) | source code
This function has to return a form. This form contains the options of the plugin that the user can change. If you want options in your plugin you have to reimplement this function. Also you will want to reimplement save_options function which is called when the user submits. In the other hand if you don't need any options you haven't to do anything.

### save_options(self, inputs) | source code
This function is called when the user filles the form returned by get_options, which is passed like argument. It's useful to save the user preferences. You can reimplement this function.

### get_actions_for_ou(self, ou) | source code
When the user navigates the organizative units tree structure it will a panel with plugins' actions. The navigator view will call this function for each plugin. You can reimplement this function to return the actions that you want the user see. The ou argument is the Organizative Unit that the user is seing.

### get_actions_for_computer(self, computer) | source code
The same that get_actions_for_ou but when the user is seing only a computer. The computer argument is the Computer that the user is seing.