[Zope-Checkins] SVN: Zope/branches/haufe-legacy-integration/ - Launchpad #375322: the <environment> section within the zope.conf

Andreas Jung andreas at andreas-jung.com
Tue May 12 04:25:59 EDT 2009


Log message for revision 99863:
  - Launchpad #375322: the <environment> section within the zope.conf
    file is now a multisection in order to provide a more modular configuration
    support.
  

Changed:
  U   Zope/branches/haufe-legacy-integration/doc/CHANGES.rst
  U   Zope/branches/haufe-legacy-integration/src/Zope2/Startup/handlers.py
  U   Zope/branches/haufe-legacy-integration/src/Zope2/Startup/tests/test_schema.py
  U   Zope/branches/haufe-legacy-integration/src/Zope2/Startup/zopeschema.xml

-=-
Modified: Zope/branches/haufe-legacy-integration/doc/CHANGES.rst
===================================================================
--- Zope/branches/haufe-legacy-integration/doc/CHANGES.rst	2009-05-12 08:12:42 UTC (rev 99862)
+++ Zope/branches/haufe-legacy-integration/doc/CHANGES.rst	2009-05-12 08:25:58 UTC (rev 99863)
@@ -23,6 +23,10 @@
 Features Added
 ++++++++++++++
 
+- Launchpad #375322: the <environment> section within the zope.conf
+  file is now a multisection in order to provide a more modular configuration
+  support.
+  
 - Launchpad #374729: Encoding cookie values to avoid issues with
   firewalls and security proxies.
 

Modified: Zope/branches/haufe-legacy-integration/src/Zope2/Startup/handlers.py
===================================================================
--- Zope/branches/haufe-legacy-integration/src/Zope2/Startup/handlers.py	2009-05-12 08:12:42 UTC (rev 99862)
+++ Zope/branches/haufe-legacy-integration/src/Zope2/Startup/handlers.py	2009-05-12 08:25:58 UTC (rev 99863)
@@ -184,8 +184,10 @@
     """
 
     # Set environment variables
-    for k,v in config.environment.items():
-        os.environ[k] = v
+    d = {}
+    for s in config.environment: 
+        d.update(s)
+    os.environ.update(d)
 
     # Add directories to the pythonpath
     instancelib = os.path.join(config.instancehome, 'lib', 'python')

Modified: Zope/branches/haufe-legacy-integration/src/Zope2/Startup/tests/test_schema.py
===================================================================
--- Zope/branches/haufe-legacy-integration/src/Zope2/Startup/tests/test_schema.py	2009-05-12 08:12:42 UTC (rev 99862)
+++ Zope/branches/haufe-legacy-integration/src/Zope2/Startup/tests/test_schema.py	2009-05-12 08:25:58 UTC (rev 99863)
@@ -101,9 +101,23 @@
               NSYNC doesnt
             </environment>
             """)
-        items = conf.environment.items()
+        items = conf.environment[0].items()
         items.sort()
         self.assertEqual(items, [("FEARFACTORY", "rocks"), ("NSYNC","doesnt")])
+        conf, handler = self.load_config_text("""\
+            # instancehome is here since it's required
+            instancehome <<INSTANCE_HOME>>
+            <environment>
+              FEARFACTORY rocks
+            </environment>
+            <environment>
+              NSYNC doesnt
+            </environment>
+            """)
+        self.assertEqual(len(conf.environment), 2)
+        # in principle, we should test the handler as well
+        #  But this would have vast side effects
+        #  Thus, we test with a non regression test
 
     def test_ms_author_via(self):
         import webdav

Modified: Zope/branches/haufe-legacy-integration/src/Zope2/Startup/zopeschema.xml
===================================================================
--- Zope/branches/haufe-legacy-integration/src/Zope2/Startup/zopeschema.xml	2009-05-12 08:12:42 UTC (rev 99862)
+++ Zope/branches/haufe-legacy-integration/src/Zope2/Startup/zopeschema.xml	2009-05-12 08:25:58 UTC (rev 99863)
@@ -292,14 +292,14 @@
     </description>
   </multisection>
 
-  <section type="environment" attribute="environment" name="*">
+  <multisection type="environment" attribute="environment" name="*">
     <description>
      A section which allows a user to define arbitrary key-value pairs for
      use as environment variables during Zope's run cycle.  It
      is not recommended to set system-related environment variables such as
      PYTHONPATH within this section.
     </description>
-  </section>
+  </multisection>
 
   <key name="instancehome" datatype="existing-directory"
        required="yes">



More information about the Zope-Checkins mailing list