[Zope-Checkins] SVN: Zope/trunk/ Protect against non-existing zope.conf path and products directories. This makes it possible to run a Zope instance without a Products or lib/python directory.

Hanno Schlichting plone at hannosch.info
Sat Nov 22 19:05:33 EST 2008


Log message for revision 93264:
  Protect against non-existing zope.conf path and products directories. This makes it possible to run a Zope instance without a Products or lib/python directory.
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Zope2/Startup/handlers.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2008-11-22 20:17:26 UTC (rev 93263)
+++ Zope/trunk/doc/CHANGES.txt	2008-11-23 00:05:33 UTC (rev 93264)
@@ -9,6 +9,10 @@
 
     Restructuring
 
+      - Protect against non-existing zope.conf path and products directories.
+        This makes it possible to run a Zope instance without a Products or
+        lib/python directory.
+
       - updated to ZODB 3.8.1
 
       - Moved exception MountedStorageError from ZODB.POSExceptions

Modified: Zope/trunk/lib/python/Zope2/Startup/handlers.py
===================================================================
--- Zope/trunk/lib/python/Zope2/Startup/handlers.py	2008-11-22 20:17:26 UTC (rev 93263)
+++ Zope/trunk/lib/python/Zope2/Startup/handlers.py	2008-11-23 00:05:33 UTC (rev 93264)
@@ -184,10 +184,11 @@
     for k,v in config.environment.items():
         os.environ[k] = v
 
-    # Add directories to the pythonpath; always insert instancehome/lib/python
+    # Add directories to the pythonpath
     instancelib = os.path.join(config.instancehome, 'lib', 'python')
     if instancelib not in config.path:
-        config.path.append(instancelib)
+        if os.path.isdir(instancelib):
+            config.path.append(instancelib)
     path = config.path[:]
     path.reverse()
     for dir in path:
@@ -195,11 +196,11 @@
 
     # Add any product directories not already in Products.__path__.
     # Directories are added in the order they are mentioned
-    # Always insert instancehome.Products
 
     instanceprod = os.path.join(config.instancehome, 'Products')
     if instanceprod not in config.products:
-        config.products.append(instanceprod)
+        if os.path.isdir(instanceprod):
+            config.products.append(instanceprod)
 
     import Products
     L = []



More information about the Zope-Checkins mailing list