[z3-checkins] r5664 - z3/Five/branch/dc-experiments/tests

dreamcatcher at codespeak.net dreamcatcher at codespeak.net
Sat Jul 24 22:37:43 MEST 2004


Author: dreamcatcher
Date: Sat Jul 24 22:37:42 2004
New Revision: 5664

Modified:
   z3/Five/branch/dc-experiments/tests/zopeconf.py
Log:

- Use $INSTANCE_HOME if available, otherwise fallback to '..' trickery



Modified: z3/Five/branch/dc-experiments/tests/zopeconf.py
==============================================================================
--- z3/Five/branch/dc-experiments/tests/zopeconf.py	(original)
+++ z3/Five/branch/dc-experiments/tests/zopeconf.py	Sat Jul 24 22:37:42 2004
@@ -1,19 +1,23 @@
-from os import curdir
+import os
 from os.path import join, abspath, dirname, split
 
+
 def process():
     """Read in zope.conf configuration file.
 
     This is a hack but there doesn't seem to be a better way.
     """
-    try:
-        __file__
-    except NameError:
-        # Test was called directly, so no __file__ global exists.
-        _prefix = abspath(curdir)
-    else:
-        # Test was called by another test.
-        _prefix = abspath(dirname(__file__))
+    _prefix = os.environ.get('INSTANCE_HOME')
+    if not _prefix:
+        try:
+            __file__
+        except NameError:
+            # Test was called directly, so no __file__ global exists.
+            _prefix = abspath(os.curdir)
+        else:
+            # Test was called by another test.
+            _prefix = abspath(dirname(__file__))
+        _prefix = join(_prefix, '..', '..', '..')
 
     from Zope.Startup.run import configure
-    configure(join(_prefix, '..', '..', '..', 'etc', 'zope.conf'))
+    configure(join(_prefix, 'etc', 'zope.conf'))


More information about the z3-checkins mailing list