[Zope-dev] Getting Zope root object without object context.
Gilles Lenfant
gilles@pilotsystems.net
Wed, 6 Nov 2002 12:59:03 +0100
> Gilles Lenfant wrote:
> >
> > I know I can get the root object using self.getPhysicalRoot()
> > But I'm in a situation where I can't get that "self" or any other Zope
> > object.
>
> Sounds like a very strange situation, tell us more about it...
>
Not that strange...
I need to get the Zope root object at startup in a FS product to get some
configuration data.
As this runs without any object context in an __init__.py, I can't rely on
any context Zope object.
But I found the workaround:
import Zope
...
root = Zope.app()
Gives the same thing as self.getPhysicalRoot()
Cheers
--Gilles
> cheers,
>
> Chris
>
>
> _______________________________________________
> Zope-Dev maillist - Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope )
>
>