On 12:53 pm, mithra...@mithrandi.net wrote:
* Terry Jones <te...@jon.es> [2009-01-20 12:23:26 +0100]:

The exact change, I believe, is that plugin source files have to be
valid python modules; that is to say, you have to be able to do:

import foo.plugins.some_plugin

This was always the intent. The change from 2.5 to 8.0 was essentially a bugfix; although not an entirely intentional one. I'm actually surprised that dashes in plugin filenames ever worked. I suspect things defined in "some-plugin.py" would have bogus __module__ attributes under 2.5, and interact oddly with some introspection tools.
I guess this restriction on plugin-containing filenames should either be documented, or the code should be made to work as it did. I'm happy to open a ticket - though the text of the ticket would depend on which solution is
preferred.

I believe this change was deliberate, so I expect it won't be reverted,
but perhaps someone else can comment further on the design motivations
(and confirm that my explanation is correct).

It definitely won't be reverted :). I don't think it should be documented in terms of a filename restriction, either.

In my opinion, the best way to deal with this would be to really improve the plugin documentation to make it clear that plugins are not magical .py files executed in a weird context, but modules which are imported normally and then have their contents inspected. I've tried writing this up a few times, but the difficulty is that there just isn't much to write: the full impact of "this is just a module" is hard to communicate.

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to