]>
jfr.im git - irc/rizon/acid.git/blob - pyva/pyva/src/main/python/plugin.py
8 class AcidPlugin(object):
10 super(AcidPlugin
, self
).__init
__()
12 self
.prefix
= core
.config
.get('control').get('prefix')
13 self
.logchan
= core
.config
.get('control').get('channel')
14 self
.log
= logging
.getLogger(__name__
)
15 self
.config
= core
.config
16 self
.dbp
= core
.dbx
.cursor() # do these have to be closed?
24 def getCommands(self
):
28 plugin_to_modname
= lambda x
: '%s.%s' % (x
, x
)
30 def loadPlugin(plugin
):
33 modname
= plugin_to_modname(plugin
)
35 mod
= importlib
.import_module(modname
)
37 obj
= getattr(mod
, plugin
)()
41 # initialization failed, remove from sys.modules so it can be reloaded
42 deps
= [module
for module
in sys
.modules
if module
.startswith(plugin
+ '.')]
50 def unloadPlugin(plugin
):
56 deps
= [module
for module
in sys
.modules
if module
.startswith(plugin
+ '.')]
65 def call(name
, *args
):
68 for m
in modules
.itervalues():
70 func
= getattr(m
, name
)