[Zope3-Users] Find the zope3 instance home directory (or the /var directory)

Eric Bréhault ebrehault at gmail.com
Tue Nov 6 05:02:38 EST 2007


Hello,

WIth Zope2, when I need to create or read a file in the filesystem, I
usually go in /myzopeinstance/var directory
and to find it is pretty easy:
import os
os.environ['CLIENT_HOME']

But in Zope3, CLIENT_HOME or INSTANCE_HOME are no longer provided in
os.environ

I had a look to different source code, and apparently the solution is to use
the path of the current file to get the instance home, so we have code like
this:
os.path.normpath(
            os.path.join(os.path.dirname(__file__),
                         os.pardir, os.pardir, os.pardir, os.pardir))

Is there any easier (and cleaner) way to do it ?

Eric BREHAULT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20071106/6a67a2dd/attachment.htm


More information about the Zope3-users mailing list