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):
"""Definition of our base plugin class"""
capabilities = None
is_permanent = None
def __init__(self):
"""Class initialiser."""
@ -135,6 +136,9 @@ for %s' % (len(self.instances), capability))
def disable(self, plugin):
"""Disable a plugin"""
if self.instances[plugin].is_permanent:
dbg("Refusing to disable permanent plugin %s" % plugin)
else:
dbg("Disabling %s" % plugin)
del(self.instances[plugin])
@ -148,6 +152,7 @@ class URLHandler(Plugin):
capabilities = ['url_handler']
handler_name = None
match = None
is_permanent = True
def callback(self, url):
"""Callback to transform the enclosed URL"""