[entropy.core] add more doc to EntropyPluginFactory and ability to disable plugins

This commit is contained in:
Fabio Erculiani
2009-08-30 19:59:11 +02:00
parent c0d9b5e6f4
commit 4f77cc4fa1
+11
View File
@@ -85,6 +85,12 @@ class EntropyPluginFactory:
above otherwise plugin won't be loaded and a warning will be
printed.
Moreover, plugin classes must be "Python new-style classes", otherwise
__subclasses__ method won't be available and class won't be considered
at all (see: http://www.python.org/doc/newstyle).
If plugin class features a "PLUGIN_DISABLED" class attribute with
a value of True, such plugin will be ignored.
@param base_plugin_class: Base EntropyPlugin-based class that valid
plugin classes must inherit from.
@@ -173,6 +179,11 @@ class EntropyPluginFactory:
"PLUGIN_API_VERSION mismatch !!!\n")
continue
if hasattr(obj, 'PLUGIN_DISABLED'):
if obj.PLUGIN_DISABLED:
# this plugin has been disabled
continue
available[modname_clean] = obj
self.__cache = available.copy()