[Twisted-Python] Plugin startup and shutdown actions
exarkun at divmod.com
Sat Apr 11 16:39:32 EDT 2009
On Sat, 11 Apr 2009 21:54:08 +0200, Esteve Fernandez <esteve at sindominio.net> wrote:
>On Saturday 11 April 2009 19:42:31 Jean-Paul Calderone wrote:
>> They can be imported from "twisted.plugins". For example, if you name your
>> "dropin" file foo_plugins.py, then "from twisted.plugins import
>> foo_plugins" should work and let you test any code that is part of your
>> plugin definitions. Note that you should try to keep the amount of code and
>> dependencies in a dropin file to a minimum, since this must all be loaded
>> and executed whenever a search for any plugin is performed.
>Shouldn't twisted and twisted/plugins be non-importable? I thought twisted and
>twisted/plugins must not have __init__.py files in order for the plugin
>system to be able to find them (through getPlugins). Or did that behavior
>change in recent versions?
They must not have __init__.py files, indeed. However, the files in
twisted/plugins/ still define sub-modules of the twisted.plugins package
due to the code in Twisted's twisted/plugins/__init__.py.
More information about the Twisted-Python