[Zope-Coders] Problem with importing ZCatalog in 2.7
Shane Hathaway
shane@zope.com
Wed, 23 Apr 2003 15:39:21 -0400
Fred L. Drake, Jr. wrote:
> Andreas Jung writes:
> > Could someone please check this issue? This issue is important because at
> > the moment it is impossible to import the ZCatalog in 2.7 *sigh*
>
> That's not what your initial report showed. It showed trying to run
> an isolated test case that assumed the persistence machinery had been
> initialized (which usually happens by importing ZODB).
>
> This is a function of the Persistence module being expected to supply
> a symbol that it doesn't initialize. That's a very weird thing for it
> to do, but I'm not going to fight the fight to get that changed!
Actually, that fight is long over. We can make the Persistence package
depend on ZODB now. ;-)
Unfortunately, I have a strong suspicion that won't actually solve
Andreas' issue, since there are other places in the code that use a
similar anti-pattern. The current recommendation is to make sure the
following code comes first:
import Zope
Zope.startup()
It's safe to put that at the top of a test module that depends heavily
on Zope.
Shane