[Zope-Checkins] CVS: Zope/lib/python/Zope/Startup - __init__.py:1.25 handlers.py:1.17 zopeschema.xml:1.32

Fred L. Drake, Jr. fred at zope.com
Mon Apr 26 02:30:06 EDT 2004


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

Modified Files:
	__init__.py handlers.py zopeschema.xml 
Log Message:
remove more clunky initialization; simply using the configuration object and
avoiding the weird handler calls makes the initialization easier to understand
(and therefore maintain)


=== Zope/lib/python/Zope/Startup/__init__.py 1.24 => 1.25 ===
--- Zope/lib/python/Zope/Startup/__init__.py:1.24	Sun Apr 25 22:39:18 2004
+++ Zope/lib/python/Zope/Startup/__init__.py	Mon Apr 26 02:29:35 2004
@@ -87,7 +87,7 @@
         self.setupPublisher()
         # Start ZServer servers before we drop privileges so we can bind to
         # "low" ports:
-        self.setupZServerThreads()
+        self.setupZServer()
         self.setupServers()
         # drop privileges after setting up servers
         self.dropPrivileges()
@@ -128,11 +128,18 @@
 
     def setupPublisher(self):
         import Globals
+        import ZPublisher.HTTPRequest
         import ZPublisher.Publish
         Globals.DevelopmentMode = self.cfg.debug_mode
         ZPublisher.Publish.set_default_debug_mode(self.cfg.debug_mode)
         ZPublisher.Publish.set_default_authentication_realm(
             self.cfg.http_realm)
+        if self.cfg.publisher_profile_file:
+            filename = self.cfg.publisher_profile_file
+            ZPublisher.Publish.install_profiling(filename)
+        if self.cfg.trusted_proxies:
+            proxies = tuple(self.cfg.trusted_proxies)
+            ZPublisher.HTTPRequest.trusted_proxies = proxies
 
     def setupSecurityOptions(self):
         import AccessControl
@@ -172,10 +179,11 @@
                     'more\ninformation on locale support.' % locale_id
                     )
 
-    def setupZServerThreads(self):
+    def setupZServer(self):
         # Increase the number of threads
         import ZServer
         ZServer.setNumberOfThreads(self.cfg.zserver_threads)
+        ZServer.CONNECTION_LIMIT = self.cfg.max_listen_sockets
 
     def setupServers(self):
         socket_err = (


=== Zope/lib/python/Zope/Startup/handlers.py 1.16 => 1.17 ===
--- Zope/lib/python/Zope/Startup/handlers.py:1.16	Sun Apr 25 17:26:17 2004
+++ Zope/lib/python/Zope/Startup/handlers.py	Mon Apr 26 02:29:35 2004
@@ -83,16 +83,6 @@
     value and _setenv('REST_OUTPUT_ENCODING' , value)
     return value
 
-def publisher_profile_file(value):
-    value is not None and _setenv('PROFILE_PUBLISHER', value)
-    from ZPublisher.Publish import install_profiling
-    install_profiling(value)
-    return value
-
-def max_listen_sockets(value):
-    import ZServer
-    ZServer.CONNECTION_LIMIT = value
-
 # server handlers
 
 def root_handler(config):
@@ -144,11 +134,6 @@
                         "Zope",
                         config.cgi_environment,
                         config.port_base)
-
-    # set up trusted proxies
-    if config.trusted_proxies:
-        import ZPublisher.HTTPRequest
-        ZPublisher.HTTPRequest.trusted_proxies = tuple(config.trusted_proxies)
 
 def handleConfig(config, multihandler):
     handlers = {}


=== Zope/lib/python/Zope/Startup/zopeschema.xml 1.31 => 1.32 ===
--- Zope/lib/python/Zope/Startup/zopeschema.xml:1.31	Sun Apr 25 17:26:17 2004
+++ Zope/lib/python/Zope/Startup/zopeschema.xml	Mon Apr 26 02:29:35 2004
@@ -450,7 +450,7 @@
     <metadefault>unset</metadefault>
   </key>
 
-  <key name="publisher-profile-file" handler="publisher_profile_file">
+  <key name="publisher-profile-file">
     <description>
      Causing this directive to point to a file on the filesystem will
      cause Zope's profiling capabilities to be enabled. For more
@@ -675,7 +675,7 @@
        I can't quite figure out how to put it there -->
 
   <key name="max-listen-sockets" datatype="integer"
-       handler="max_listen_sockets" default="1000">
+       default="1000">
      <description>
        The maximum number of sockets that ZServer will attempt to open
        in order to service incoming connections.




More information about the Zope-Checkins mailing list