[Zope-Checkins] CVS: Zope/lib/python/Zope/Startup - __init__.py:1.23 handlers.py:1.16 zopeschema.xml:1.31

Fred L. Drake, Jr. fred at zope.com
Sun Apr 25 17:26:18 EDT 2004


Update of /cvs-repository/Zope/lib/python/Zope/Startup
In directory cvs.zope.org:/tmp/cvs-serv13370/Zope/Startup

Modified Files:
	__init__.py handlers.py zopeschema.xml 
Log Message:
Remove all uses of environment variables for configuring ZPublisher.


=== Zope/lib/python/Zope/Startup/__init__.py 1.22 => 1.23 ===
--- Zope/lib/python/Zope/Startup/__init__.py:1.22	Fri Apr 23 13:54:19 2004
+++ Zope/lib/python/Zope/Startup/__init__.py	Sun Apr 25 17:26:17 2004
@@ -60,8 +60,11 @@
     """
     def __init__(self):
         self.event_logger = logging.getLogger()
-        # set up our initial logging environment (log everything to stderr
-        # if we're not in debug mode).
+        # We log events to the root logger, which is backed by a
+        # "StartupHandler" log handler.  The "StartupHandler" buffers
+        # log messages.  When the "real" loggers are set up, we flush
+        # accumulated messages in StartupHandler's buffers to the real
+        # logger.
         formatter = logging.Formatter(
             "%(asctime)s %(levelname)s %(name)s %(message)s",
             "%Y-%m-%d %H:%M:%S")
@@ -78,14 +81,10 @@
         self.cfg = cfg
 
     def prepare(self):
-        # we log events to the root logger, which is backed by a
-        # "StartupHandler" log handler.  The "StartupHandler" outputs to
-        # stderr but also buffers log messages.  When the "real" loggers
-        # are set up, we flush accumulated messages in StartupHandler's
-        # buffers to the real logger.
         self.setupInitialLogging()
         self.setupLocale()
         self.setupSecurityOptions()
+        self.setupPublisher()
         # Start ZServer servers before we drop privileges so we can bind to
         # "low" ports:
         self.setupZServerThreads()
@@ -126,6 +125,13 @@
 
     def error(self, msg):
         logger.error(msg)
+
+    def setupPublisher(self):
+        import Globals
+        import ZPublisher.Publish
+        Globals.DevelopmentMode = self.cfg.debug_mode
+        ZPublisher.Publish.set_default_debug_mode(self.cfg.debug_mode)
+        ZPublisher.Publish.set_default_realm(self.cfg.http_realm)
 
     def setupSecurityOptions(self):
         import AccessControl


=== Zope/lib/python/Zope/Startup/handlers.py 1.15 => 1.16 ===
--- Zope/lib/python/Zope/Startup/handlers.py:1.15	Thu Jan 15 18:05:08 2004
+++ Zope/lib/python/Zope/Startup/handlers.py	Sun Apr 25 17:26:17 2004
@@ -16,12 +16,6 @@
     else:
         os.environ[name] = `value`
 
-def debug_mode(value):
-    value and _setenv('Z_DEBUG_MODE', '1')
-    import Globals
-    Globals.DevelopmentMode = not not value
-    return value
-
 def locale(value):
     import locale
     locale.setlocale(locale.LC_ALL, value)
@@ -93,10 +87,6 @@
     value is not None and _setenv('PROFILE_PUBLISHER', value)
     from ZPublisher.Publish import install_profiling
     install_profiling(value)
-    return value
-
-def http_realm(value):
-    value is not None and _setenv('Z_REALM', value)
     return value
 
 def max_listen_sockets(value):


=== Zope/lib/python/Zope/Startup/zopeschema.xml 1.30 => 1.31 ===
--- Zope/lib/python/Zope/Startup/zopeschema.xml:1.30	Thu Apr 22 15:20:07 2004
+++ Zope/lib/python/Zope/Startup/zopeschema.xml	Sun Apr 25 17:26:17 2004
@@ -328,8 +328,7 @@
     <metadefault>$clienthome/Z2.lock</metadefault>
   </key>
 
-  <key name="debug-mode" datatype="boolean" default="on"
-       handler="debug_mode">
+  <key name="debug-mode" datatype="boolean" default="on">
     <description>
     A switch which controls several aspects of Zope operation useful for
     developing under Zope.  When debug mode is on:
@@ -486,7 +485,7 @@
     </description>
   </key>
 
-  <key name="http-realm" default="Zope" handler="http_realm">
+  <key name="http-realm" default="Zope">
     <description>
      The HTTP "Realm" header value sent by this Zope instance. This value
      often shows up in basic authentication dialogs.




More information about the Zope-Checkins mailing list