From: Chris Withers <[EMAIL PROTECTED]>
> I'm trying to make Squishdot work with INSTANCE_HOME nicely.
> However, the testing is going wrong on a normal Win32 Install...
> I had lots of lines that went something like:
>         f=open('%s/Products/%s.dtml' % (SOFTWARE_HOME,file))
> Which generates:
> E:\Zope\2.2.0\lib\python/Products/Squishdot/validArticle.dtml
> That's not very nice in itself but seems to work with Python's open...
> However, when I change them all to be like, for example:
>        f=open('%s/Products/%s.dtml' % (INSTANCE_HOME,file))
> I then get:
> 'E:\\Zope\\2.2.0/Products/Squishdot/validArticle.dtml'

This looks correct to me.  If no explicit INSTANCE_HOME is set, it defaults
to SOFTWARE_HOME minus '/lib/python'.

On the other hand, I wonder why you're constructing '%s/Products/' paths
explicitly like this.  If this code is inside the Product to which you would
like the path, the proper way to get the path is:

from Globals import package_home
path = package_home(globals())
# path now probably equals
'E:\\Zope\\2.2.0\\lib\\python\\Products\\Squishdot' in your example.

I have no idea if or where this is documented, sadly.  I'll definitely put
it in my 'writing INSTANCE_HOME-friendly Products' howto, as soon as I get
around to writing such a thing :-/  Or perhaps you could? ;-)


Evan @ digicool & 4-am

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to