On Tue, Dec 03, 2002 at 08:46:04AM -0700, Jonathan Corbet wrote: > Hmm...I think I like my way better. The publisher really knows very little > about the tree(s) it is exporting, and, I think, it should be that way. > _q_import lets you set up a different regime in different places, and to > put the import logic right with the part of the namespace that it affects. I agree that _q_import is better than overriding something in the publisher. I'm worried about introducting too many magical _q_* names that control traversal though. Couldn't we use _q_getname for this purpose? Currently, _q_getname only gets called for names not in _q_exports. We could change it so that _q_getname was also called if name was in _q_exports but not in the namespace. If there as no _q_getname then the current "guess it's a sub-module" import would happen. An example lazy importing _q_getname would be: def _g_getname(request, component): global something if component == 'something': from somewhere import something else: raise TraversalError Does that meet your needs? There is a minor backwards incompatibility with this idea. Applications with modules that have both a _q_getname and rely on automatic importing would break. I looked through our code and only found one module like this and it's easily fixed. Neil