Some plugins can't ever be disabled. Detect and obey

This commit is contained in:
Chris Jones 2010-06-20 22:56:19 +01:00
parent c649da9949
commit 80289911f1
1 changed files with 7 additions and 2 deletions

View File

@ -32,6 +32,7 @@ from util import dbg, err, get_config_dir
class Plugin(object): class Plugin(object):
"""Definition of our base plugin class""" """Definition of our base plugin class"""
capabilities = None capabilities = None
is_permanent = None
def __init__(self): def __init__(self):
"""Class initialiser.""" """Class initialiser."""
@ -135,8 +136,11 @@ for %s' % (len(self.instances), capability))
def disable(self, plugin): def disable(self, plugin):
"""Disable a plugin""" """Disable a plugin"""
dbg("Disabling %s" % plugin) if self.instances[plugin].is_permanent:
del(self.instances[plugin]) dbg("Refusing to disable permanent plugin %s" % plugin)
else:
dbg("Disabling %s" % plugin)
del(self.instances[plugin])
# This is where we should define a base class for each type of plugin we # This is where we should define a base class for each type of plugin we
# support # support
@ -148,6 +152,7 @@ class URLHandler(Plugin):
capabilities = ['url_handler'] capabilities = ['url_handler']
handler_name = None handler_name = None
match = None match = None
is_permanent = True
def callback(self, url): def callback(self, url):
"""Callback to transform the enclosed URL""" """Callback to transform the enclosed URL"""