[Zope] maybe importing a Zope module

KevinL darius@obsidian.com.au
12 Oct 2002 11:28:28 +1000


Heya,

Is there a good reliable (documented?:) way for a product to tell if
it's being imported by Zope or not?

I've got a product which may or may not be imported by Zope.  If it is,
then it should load up the Zope-specific stuff and make it available -
but if it's not, then it should ignore all that stuff (because it'll
raise errors on trying to get DTMLFile and similar), and just present a
simpler view of itself to the world.

I can try and import as though it's a Zope module, and wrap that in
try...excepts, but that seems dodgy - it'd mean I lose my nice
tracebacks in the product control panel if I break the product at any
time.

Is there a better way?

KevinL