[Zope-Checkins] SVN: Products.Five/trunk/zcml.py Setup a check for zcml load_site() so check skel when unit testing is occurring.

Rocky Burt rocky at serverzen.com
Mon May 29 17:37:10 EDT 2006


Log message for revision 68373:
  Setup a check for zcml load_site() so check skel when unit testing is occurring.

Changed:
  U   Products.Five/trunk/zcml.py

-=-
Modified: Products.Five/trunk/zcml.py
===================================================================
--- Products.Five/trunk/zcml.py	2006-05-29 21:12:41 UTC (rev 68372)
+++ Products.Five/trunk/zcml.py	2006-05-29 21:37:09 UTC (rev 68373)
@@ -32,14 +32,22 @@
 
     # load instance site configuration file
     site_zcml = os.path.join(INSTANCE_HOME, "etc", "site.zcml")
-    if not os.path.exists(site_zcml):
-        raise IOError("site.zcml is now required to live at '%s', for " \
-                      "sites upgraded from Zope 2.9 please copy site.zcml " \
-                      "from your installed Zope's skel/etc directory" \
-                      % site_zcml)
+    skel_site_zcml = os.path.join(INSTANCE_HOME, "skel", "etc", "site.zcml")
+    
+    if os.path.exists(site_zcml):
+        file = site_zcml
+    elif os.path.exists(skel_site_zcml):
+        # check for zope installation home skel during running unit tests
+        file = skel_site_zcml
+    else:
+        msg = "site.zcml is now required to live at '%s', for " \
+              "sites upgraded from Zope 2.9 please copy site.zcml " \
+              "from your installed Zope's skel/etc directory" \
+              % site_zcml 
+        raise IOError(msg)
 
     global _context
-    _context = xmlconfig.file(site_zcml)
+    _context = xmlconfig.file(file)
 
 
 def load_config(file, package=None, execute=True):



More information about the Zope-Checkins mailing list