zopefoundation / zope.configuration

Extensible system for supporting various kinds of configurations
https://zopeconfiguration.readthedocs.io
Other
1 stars 6 forks source link

Dotted name resolver accepts '/' as module name separator #6

Closed tseaver closed 5 years ago

tseaver commented 9 years ago

In https://bugs.launchpad.net/zope.configuration/+bug/161984 @ctheune reported:

It's possible to do something like this:

<include package="zope/config.config"/>

This will result in a separate import so that zope.config.config and zope/config.config are two different modules. This can lead to confusing errors because all the ZCML is executed but doesn't seem to apply (maybe even just partially doesn't apply).

It currently works this way because Python's __import__ function allows '/' and '.' to be used. However, I couldn't find any documentation on the __import__ function that says that '/' is being treated as a path separator. Maybe this should be reported to Python's tracker as well.

I propose to modify the definition of the schema field to not accept slashes.