Synchronized Commands (basically, all command-based plugins). Should fix the issue with Karma causing crashes due to PySQLite's un-thread-friendliness.

This commit is contained in:
Jeremy Fincher 2005-05-15 18:27:12 +00:00
parent cbf154b4ff
commit ce74fa825e
1 changed files with 12 additions and 0 deletions

View File

@ -1036,11 +1036,20 @@ class BasePlugin(object):
cb.log = log.getPluginLogger('%s.%s' % (self.name(),cb.name()))
super(BasePlugin, self).__init__(*args, **kwargs)
class SynchronizedAndFirewalled(log.MetaFirewall, utils.python.Synchronized):
pass # Necessary for the metaclass compatibility issue.
class Commands(BasePlugin):
# For awhile, a comment stood here to say, "Eventually callCommand." But
# that's wrong, because we can't do generic error handling in this
# callCommand -- plugins need to be able to override callCommand and do
# error handling there (see the Http plugin for an example).
__metaclass__ = SynchronizedAndFirewalled
__synchronized__ = (
'__call__',
'callCommand',
'invalidCommand',
)
__firewalled__ = {'isCommand': None,
'_callCommand': None}
commandArgs = ['self', 'irc', 'msg', 'args']
@ -1049,6 +1058,9 @@ class Commands(BasePlugin):
def name(self):
return self.__class__.__name__
def __call__(self, *args, **kwargs):
super(Commands, self).__call__(*args, **kwargs)
def canonicalName(self):
return canonicalName(self.name())