| Home | Trees | Indices | Help |
|
|---|
|
|
| Instance Methods | |||
| None |
|
||
|
|||
| string |
|
||
| None |
|
||
| None |
|
||
|
Inherited from |
|||
| Class Variables | |
BASE_PLUGIN_API_VERSION = 1This is a plugin base class for all SystemSettings plugins. |
|
| Properties | |
|
Inherited from |
| Method Details |
SystemSettingsPlugin constructor.
|
You must call this method in order to add your custom
parsers to the plugin.
Please note, if your parser method ends with "_parser"
it will be automatically added this way:
method: foo_parser
parser_id => foo
method: another_fabulous_parser
parser_id => another_fabulous
@param parser_id: parser identifier, must be unique
@type parser_id: string
@param parser_callable: any callable function which has
the following signature: callable(system_settings_instance)
can return True to stop further parsers calls
@type parser_callable: callable
@return: None
@rtype: None
|
Returns the unique plugin id passed at construction time.
|
This method is called by SystemSettings instance when building its settings metadata. Returned data from parser will be put into the SystemSettings dict using plugin_id and parser_id keys. If returned data is None, SystemSettings dict won't be changed.
|
This method is called by SystemSettings instance after having built all the SystemSettings metadata. You can reimplement this and hook your refinement code into this method.
|
| Class Variable Details |
BASE_PLUGIN_API_VERSIONThis is a plugin base class for all SystemSettings plugins. It allows to add extra parsers (though metadata) to SystemSettings. Just inherit from this class and call add_parser to add your custom parsers. SystemSettings will call the parse method, as explained below. Sample code: >>> # load SystemSettings >>> from entropy.core.settings.base import SystemSettings >>> from entropy.core.settings.plugins.skel import SystemSettingsPlugin >>> system_settings = SystemSettings() >>> class MyPlugin(SystemSettingsPlugin): >>> pass >>> my_plugin = MyPlugin('mystuff', None) >>> def myparsing_function(): >>> return {'abc': 1 } >>> my_plugin.add_parser('parser_no_1', myparsing_function) >>> system_settings.add_plugin(my_plugin) >>> print(system_settings['mystuff']['parser_no_1']) {'abc': 1 } >>> # let's remove it >>> system_settings.remove_plugin('mystuff') # through its plugin_id >>> print(system_settings.get('mystuff')) None
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Fri Sep 4 11:50:11 2009 | http://epydoc.sourceforge.net |