mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 04:32:36 +01:00
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:
parent
cbf154b4ff
commit
ce74fa825e
@ -1036,11 +1036,20 @@ class BasePlugin(object):
|
|||||||
cb.log = log.getPluginLogger('%s.%s' % (self.name(),cb.name()))
|
cb.log = log.getPluginLogger('%s.%s' % (self.name(),cb.name()))
|
||||||
super(BasePlugin, self).__init__(*args, **kwargs)
|
super(BasePlugin, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
class SynchronizedAndFirewalled(log.MetaFirewall, utils.python.Synchronized):
|
||||||
|
pass # Necessary for the metaclass compatibility issue.
|
||||||
|
|
||||||
class Commands(BasePlugin):
|
class Commands(BasePlugin):
|
||||||
# For awhile, a comment stood here to say, "Eventually callCommand." But
|
# For awhile, a comment stood here to say, "Eventually callCommand." But
|
||||||
# that's wrong, because we can't do generic error handling in this
|
# that's wrong, because we can't do generic error handling in this
|
||||||
# callCommand -- plugins need to be able to override callCommand and do
|
# callCommand -- plugins need to be able to override callCommand and do
|
||||||
# error handling there (see the Http plugin for an example).
|
# error handling there (see the Http plugin for an example).
|
||||||
|
__metaclass__ = SynchronizedAndFirewalled
|
||||||
|
__synchronized__ = (
|
||||||
|
'__call__',
|
||||||
|
'callCommand',
|
||||||
|
'invalidCommand',
|
||||||
|
)
|
||||||
__firewalled__ = {'isCommand': None,
|
__firewalled__ = {'isCommand': None,
|
||||||
'_callCommand': None}
|
'_callCommand': None}
|
||||||
commandArgs = ['self', 'irc', 'msg', 'args']
|
commandArgs = ['self', 'irc', 'msg', 'args']
|
||||||
@ -1049,6 +1058,9 @@ class Commands(BasePlugin):
|
|||||||
def name(self):
|
def name(self):
|
||||||
return self.__class__.__name__
|
return self.__class__.__name__
|
||||||
|
|
||||||
|
def __call__(self, *args, **kwargs):
|
||||||
|
super(Commands, self).__call__(*args, **kwargs)
|
||||||
|
|
||||||
def canonicalName(self):
|
def canonicalName(self):
|
||||||
return canonicalName(self.name())
|
return canonicalName(self.name())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user