[Zope] probably a faq: access INSTANCE_HOME
Chris McDonough
chrism@zope.com
08 Nov 2002 17:29:28 -0500
Actually it's even easier. It's a builtin. You can refer to
INSTANCE_HOME anywhere in a Zope app and it will be returned.
On Fri, 2002-11-08 at 17:20, Charlie Reiman wrote:
> It's just an enviornment variable, so I assume:
>
> import os
> os.getenv('INSTANCE_HOME')
>
> should work for an external method.
>
> > -----Original Message-----
> > From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Mark
> > McEahern
> > Sent: Friday, November 08, 2002 2:06 PM
> > To: Zope Mailing List
> > Subject: [Zope] probably a faq: access INSTANCE_HOME
> >
> >
> > Admittedly, I spent 5 minutes searching and no joy...
> >
> > How does one access INSTANCE_HOME in an external method?
> >
> > The logic I need is something like this--I'm just missing the incantation
> > for my fanciful getZopeEnviron.
> >
> > Help?
> >
> > # a fanciful dream...
> >
> > import os
> >
> > def dostuff(self):
> >
> > location = self.getZopeEnviron("INSTANCE_HOME", None)
> > if not location:
> > location = self.getZopeEnviron("SOFTWARE_HOME", None)
> > if not location:
> > raise PukeOla("What the f---?")
> > import_dir = os.path.join(location, "import")
> > # Now we're cooking with fire...
> >
> > Cheers,
> >
> > // m
> >
> > ->
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )