[Zope-dev] INSTANCE_HOME, SOFTWARE_HOME and package_home

Chris Withers chrisw@nipltd.com
Wed, 13 Sep 2000 11:50:31 +0100


Evan Simpson wrote:
> >         f=open('%s/Products/%s.dtml' % (SOFTWARE_HOME,file))
> > E:\Zope\2.2.0\lib\python/Products/Squishdot/validArticle.dtml

> >        f=open('%s/Products/%s.dtml' % (INSTANCE_HOME,file))
> > 'E:\\Zope\\2.2.0/Products/Squishdot/validArticle.dtml'
> 
> This looks correct to me.  

Not to me! :-(

Okay, I can understand (but not approve of) having a mixture of \ and /
in a string (I guess python's open takes care of that) but what's with
the \\ in the INSTANCE_HOME case?! Also be my comment on the /lib/python
bit below ;-)

> If no explicit INSTANCE_HOME is set, it defaults
> to SOFTWARE_HOME minus '/lib/python'.

Can you explain why that makes sense please ;-)
Surely it'd be more useful to default to SOFTWARE_HOME including
'/lib/python' so that old code wasn't broken?

> On the other hand, I wonder why you're constructing '%s/Products/' paths
> explicitly like this.  

It was done by Butch ages ago. He probably did it 'cos it worked and the
'correct' way wasn't documented anywhere :P

> 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.

And that'll work in INSTANCE_HOME (in either the base or instance parts)
Zope installs as well as non-instance home ones?

> I have no idea if or where this is documented, sadly.  

no comment ;-)

> I'll definitely put
> it in my 'writing INSTANCE_HOME-friendly Products' howto, as soon as I get
> around to writing such a thing :-/ 

Soon, I hope, 'cos it sounds like a great idea

> Or perhaps you could? ;-)

The biggest thing I think is needed is a clear definition of what all of
these _should_ be and what they _are_. This needs to be done by someone
who understands them all and that's clearly not me ;-)

cheers,

Chris