Re: [Zope-dev] is INSTANCE_HOME broken on Win32?

2000-09-14 Thread Rik Hoekstra


> Any ideas?


the python way of getting the right path separators is to use 

os.path.join(item1, item2, ...)

Works even for macs ;-)

Rik


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope-dev] is INSTANCE_HOME broken on Win32?

2000-09-11 Thread Evan Simpson

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? ;-)

Cheers,

Evan @ digicool & 4-am


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )




[Zope-dev] is INSTANCE_HOME broken on Win32?

2000-09-11 Thread Chris Withers

Hello :-)

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'

which is:

- horrible
- wrong
- doesn't work ;-)

Anyway, I'm looking for something like INSTANCE_HOME or SOFTWARE_HOME
that:

- works in an INSTANCE_HOME setup
- works in a non-INSTANCE_HOME setup
- works on both Unix and Windows..

Any ideas?

cheers,

Chris

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )