[Zope-dev] Re: Conditional imports in ZTUtils/__init__.py

Evan Simpson evan at 4-am.com
Tue Oct 5 10:47:11 EDT 2004


Stefan H. Holek wrote:
> ZTUtils/__init__.py contains code like this:
> 
>   if sys.modules.has_key('Zope'):
> 
>       # import things
> 
> This is causing me repeated headaches when writing tests, because it 
> assumes/dictates a certain module import order. Can this go away, 
> please? I mean we know we are running Zope, don't we?

This is part of my attempt to allow the various bits of ZPT to work 
outside of Zope.  It assumes that the presence of the 'Zope' module is a 
reliable test.  Perhaps this is a YAGNI, or perhaps there's a better way 
of accomodating non-Zope users.

Cheers,

Evan @ 4-am



More information about the Zope-Dev mailing list