[Zope-Coders] Win32 builds

Andy McKay andy@agmweb.ca
Tue, 24 Sep 2002 17:00:10 -0700


This is a multi-part message in MIME format.

------=_NextPart_000_0115_01C263EB.D77AF860
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

So now the beta's out and its fresh in the person who did its mind (Matt)
did anything get written down about how to it's done someone externally
could do it?

And secondly what the heck is going on with z2.py?

I was whining that zope 2.6.1 was borked because z2.py is clearly borked in
cvs for windows. However I figured something wierd must go on when a build
is done (surely it would be spotted). Sure enough the z2.py that comes with
the windows binary installation from zope.org is totally different from any
version I could find in cvs (I looked) or the src distribution.

Sure enough
http://cvs.zope.org/Zope/z2.py?only_with_tag=Zope-2-6-0b1-win32-x86 is the
the same as the one in the src distro, but the on I get installing zope 2 on
windows is very different.

So what gives? Where does this z2.py come from? Why has it got a ZPL 1.0
license? Is this just a simple mistake?

This sort of implies to me that zope cant be built from source on Windows...
;)

Diff attached.
--
  Andy McKay
  www.agmweb.ca

------=_NextPart_000_0115_01C263EB.D77AF860
Content-Type: text/plain;
	name="diff.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="diff.txt"

--- e:\Zope26src\z2.py	Thu Sep 05 12:53:50 2002
+++ z2.py	Tue Sep 24 14:17:40 2002
@@ -1,14 +1,86 @@
 =
#########################################################################=
#####
-#
-# Copyright (c) 2001 Zope Corporation and Contributors. All Rights =
Reserved.
-#
-# This software is subject to the provisions of the Zope Public =
License,
-# Version 2.0 (ZPL).  A copy of the ZPL should accompany this =
distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND =
FITNESS
-# FOR A PARTICULAR PURPOSE
-#
+#=20
+# Zope Public License (ZPL) Version 1.0
+# -------------------------------------
+#=20
+# Copyright (c) Digital Creations.  All rights reserved.
+#=20
+# This license has been certified as Open Source(tm).
+#=20
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions =
are
+# met:
+#=20
+# 1. Redistributions in source code must retain the above copyright
+#    notice, this list of conditions, and the following disclaimer.
+#=20
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions, and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#=20
+# 3. Digital Creations requests that attribution be given to Zope
+#    in any manner possible. Zope includes a "Powered by Zope"
+#    button that is installed by default. While it is not a license
+#    violation to remove this button, it is requested that the
+#    attribution remain. A significant investment has been put
+#    into Zope, and this effort will continue if the Zope community
+#    continues to grow. This is one way to assure that growth.
+#=20
+# 4. All advertising materials and documentation mentioning
+#    features derived from or use of this software must display
+#    the following acknowledgement:
+#=20
+#      "This product includes software developed by Digital Creations
+#      for use in the Z Object Publishing Environment
+#      (http://www.zope.org/)."
+#=20
+#    In the event that the product being advertised includes an
+#    intact Zope distribution (with copyright and license included)
+#    then this clause is waived.
+#=20
+# 5. Names associated with Zope or Digital Creations must not be used =
to
+#    endorse or promote products derived from this software without
+#    prior written permission from Digital Creations.
+#=20
+# 6. Modified redistributions of any form whatsoever must retain
+#    the following acknowledgment:
+#=20
+#      "This product includes software developed by Digital Creations
+#      for use in the Z Object Publishing Environment
+#      (http://www.zope.org/)."
+#=20
+#    Intact (re-)distributions of any official Zope release do not
+#    require an external acknowledgement.
+#=20
+# 7. Modifications are encouraged but must be packaged separately as
+#    patches to official Zope releases.  Distributions that do not
+#    clearly separate the patches from the original work must be =
clearly
+#    labeled as unofficial distributions.  Modifications which do not
+#    carry the name Zope may be packaged in any form, as long as they
+#    conform to all of the clauses above.
+#=20
+#=20
+# Disclaimer
+#=20
+#   THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
+#   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+#   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
+#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+#   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+#   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+#   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+#   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+#   SUCH DAMAGE.
+#=20
+#=20
+# This software consists of contributions made by Digital Creations and
+# many individuals on behalf of Digital Creations.  Specific
+# attributions are listed in the accompanying credits file.
+#=20
 =
#########################################################################=
#####
 """Zope 2 ZServer start-up file
=20
@@ -36,7 +108,7 @@
     relative to the Zope location.
=20
     To prevent use of a separate management process, provide an
-    empty string: -Z=3D''
+    empty string: -Z ''
=20
   -t n
=20
@@ -48,7 +120,7 @@
     Set the interpreter check interval. This integer value
     determines how often the interpreter checks for periodic things
     such as thread switches and signal handlers. The Zope default
-    is 500, but you may want to experiment with other values that
+    is 120, but you may want to experiment with other values that
     may increase performance in your particular environment.
=20
   -D
@@ -69,12 +141,12 @@
     (e.g. -d ''), then IP addresses will not be logged. If you have
     DNS service on your local machine then you can set this to
     127.0.0.1.  The default is: %(DNS_IP)s.
-
+   =20
   -u username or uid number
-
-    The username to run ZServer as.  You may want to run ZServer as
-    a dedicated user.  This only works under Unix, and if ZServer
-    is started as root, and is required in that case.
+ =20
+    The username to run ZServer as. You may want to run ZServer as =
'nobody'
+    or some other user with limited resouces. The only works under =
Unix, and
+    if ZServer is started by root. The default is: %(UID)s
=20
   -P [ipaddress:]number
=20
@@ -88,9 +160,9 @@
     to listen on different addresses.
=20
     Multiple -P options can be provided to run multiple sets of =
servers.
-
+   =20
   -w port
-
+ =20
     The Web server (HTTP) port.  This defaults to %(HTTP_PORT)s. The
     standard port for HTTP services is 80.  If this is a dash
     (e.g. -w -), then HTTP is disabled.
@@ -102,7 +174,7 @@
     Multiple -w options can be provided to run multiple servers.
=20
   -W port
-
+ =20
     The "WebDAV source" port.  If this is a dash (e.g. -w -), then
     "WebDAV source" is disabled.  The default is disabled.  Note that
     this feature is a workaround for the lack of "source-link" support
@@ -114,15 +186,8 @@
=20
     Multiple -W options can be provided to run multiple servers.
=20
-  -C
-  --force-http-connection-close
-
-    If present, this option causes Zope to close all HTTP connections,
-    regardless of the 'Connection:' header (or lack of one) sent by
-    the client.
-
   -f port
-
+ =20
     The FTP port.  If this is a dash (e.g. -f -), then FTP
     is disabled.  The standard port for FTP services is 21.  The
     default is %(FTP_PORT)s.
@@ -146,7 +211,7 @@
     not specified then the FastCGI Server is disabled.
=20
   -m port
-
+ =20
     The secure monitor server port. If this is a dash
     (-m -), then the monitor server is disabled. The monitor server
     allows interactive Python style access to a running ZServer. To
@@ -161,33 +226,21 @@
=20
     Multiple -m options can be provided to run multiple servers.
=20
-  --icp port
-
-    The ICP port. ICP can be used to distribute load between back-end
-    zope servers, if you are using an ICP-aware front-end proxy such
-    as Squid.
-
-    The port can be preeceeded by an ip address follwed by a colon
-    to specify an address to listen on. This allows different servers
-    to listen on different addresses.
-
-    Multiple --icp options can be provided to run multiple servers.
-
   -l path
=20
     Path to the ZServer log file. If this is a relative path then the
     log file will be written to the 'var' directory. The default is
-    %(LOG_FILE)s.
+    %(LOG_FILE)s.=20
=20
   -r
-
+   =20
     Run ZServer is read-only mode. ZServer won't write anything to =
disk.
     No log files, no pid files, nothing. This means that you can't do a
     lot of stuff like use PCGI, and zdaemon. ZServer will log hits to
     STDOUT and zLOG will log to STDERR.
=20
   -L
-
+ =20
     Enable locale (internationalization) support. The value passed for
     this option should be the name of the locale to be used (see your
     operating system documentation for locale information specific to
@@ -207,7 +260,7 @@
     web server:
=20
       %(program)s -X -w80
-
+     =20
   -M file
=20
     Save detailed logging information to the given file.
@@ -229,7 +282,7 @@
 # win32 binary distribution, the installer will have replaced the
 # marker string with the actual software home. If that has not
 # happened, then the path munging code is skipped.
-swhome=3Dr'INSERT_SOFTWARE_HOME'
+swhome=3Dr'e:\zope26'
 if swhome !=3D 'INSERT_SOFTWARE_HOME':
     import sys
     sys.path.insert(0, '%s/lib/python' % swhome)
@@ -240,20 +293,15 @@
     sys.path.insert(5, '%s' % swhome)
=20
=20
-import os, sys, getopt, codecs, string
-import socket
+import os, sys, getopt, string
=20
-from types import StringType, IntType
-# workaround to allow unicode encoding conversions in DTML
-dummy =3D codecs.lookup('iso-8859-1')
+sys.setcheckinterval(120)
=20
-sys.setcheckinterval(500)
=20
 program=3Dsys.argv[0]
 here=3Dos.path.join(os.getcwd(), os.path.split(program)[0])
 Zpid=3D''
=20
-
 =
########################################################################
 # Configuration section
=20
@@ -274,9 +322,8 @@
 DNS_IP=3D''
=20
 # User id to run ZServer as. Note that this only works under Unix, and =
if
-# ZServer is started by root. This no longer defaults to 'nobody' since
-# that can lead to a Zope file compromise.
-UID=3DNone
+# ZServer is started by root.
+UID=3D'nobody'
=20
 # Log file location. If this is a relative path, then it is joined the
 # the 'var' directory.
@@ -291,10 +338,6 @@
 # HTTP enivornment settings.
 HTTP_ENV=3D{}
=20
-# Should we close all HTTP connections, ignoring the (usually absent)
-# 'Connection:' header?
-FORCE_HTTP_CONNECTION_CLOSE=3D0
-
 # Port for the special "WebDAV source view" HTTP handler.  There is no
 # standard port for this handler, which is disabled by default.
 WEBDAV_SOURCE_PORT=3D[]
@@ -313,18 +356,18 @@
 ## Monitor configuration
 MONITOR_PORT=3D0
=20
-## ICP configuration
-ICP_PORT=3D0
-
 # Module to be published, which must be Main or Zope
 MODULE=3D'Zope'
=20
 # The size of the thread pool, if ZODB3 is used.
 NUMBER_OF_THREADS=3D4
=20
+
 # Localization support
 LOCALE_ID=3DNone
=20
+
+
 # Socket path or port for the FastCGI Server
 FCGI_PORT=3DNone
=20
@@ -340,7 +383,7 @@
 def server_info(old, v, offset=3D0):
     # interpret v as a port or address/port and get new value
     if v =3D=3D '-': v=3D''
-    l=3Dv.find(':')
+    l=3Dstring.find(v, ':')
     if l >=3D 0:
         a=3Dv[:l]
         v=3Dv[l+1:]
@@ -348,59 +391,38 @@
         a=3DIP_ADDRESS
=20
     if not v: return v
-
-    try:
-        v=3Dint(v)
+       =20
+    try:=20
+        v=3Dstring.atoi(v)
         if v < 0: raise 'Invalid port', v
         v=3Dv+offset
     except: raise 'Invalid port', v
=20
-    if isinstance(old, IntType): old=3D[(a,v)]
+    if type(old) is type(0): old=3D[(a,v)]
     else: old.append((a,v))
=20
-    return old
-
+    return old   =20
+   =20
=20
 try:
-    python_version =3D sys.version.split()[0]
-    if python_version < '2.1':
-        raise 'Invalid python version', python_version
-    if python_version[:3] =3D=3D '2.1':
-        if python_version[4:5] < '3':
-            import warnings
-            err =3D ('You are running Python version %s.  This Python =
version '
-                   'has known bugs that may cause Zope to run =
improperly. '
-                   'Consider upgrading to a Python in the 2.1 series '
-                   'with at least version number 2.1.3.  (Note that =
Zope does '
-                   'not yet run under any Python 2.2 version).' %
-                   python_version)
-            warnings.warn(err)
-    if python_version[:3] =3D=3D '2.2':
-        import warnings
-        err =3D ('You are running Python version %s.  This Python =
version '
-               'has not yet been tested with Zope and you may =
experience '
-               'operational problems as a result.  Consider using '
-               'Python 2.1.3 instead.' % python_version)
-        warnings.warn(err)
+    if string.split(sys.version)[0] < '2.1':
+        raise 'Invalid python version', string.split(sys.version)[0]
=20
-
     opts, args =3D getopt.getopt(sys.argv[1:],
-                               =
'hz:Z:t:i:a:d:u:w:W:f:p:m:Sl:2DP:rF:L:XM:C',
-                               ['icp=3D', 'force-http-connection-close'
-                               ])
+                               =
'hz:Z:t:i:a:d:u:w:W:f:p:m:Sl:2DP:rF:L:XM:')
=20
     DEBUG=3D0
     READ_ONLY=3D0
-
+   =20
     # Get environment variables
     for a in args:
-        if a.find('=3D'):
-            a=3Da.split('=3D')
+        if string.find(a,'=3D'):
+            a=3Dstring.split(a,'=3D')
             o=3Da[0]
-            v=3D'=3D'.join(a[1:])
-            if o:
-                os.environ[o]=3Dv
-                HTTP_ENV[o]=3Dv
+            v=3Dstring.join(a[1:],'=3D')
+            if o:=20
+              os.environ[o]=3Dv
+              HTTP_ENV[o]=3Dv
         else:
             raise 'Invalid argument', a
=20
@@ -411,12 +433,12 @@
             Zpid=3Dv
         elif o=3D=3D'-r': READ_ONLY=3D1
         elif o=3D=3D'-t':
-            try: v=3Dint(v)
+            try: v=3Dstring.atoi(v)
             except: raise 'Invalid number of threads', v
             NUMBER_OF_THREADS=3Dv
=20
         elif o=3D=3D'-i':
-            try: v=3Dint(v)
+            try: v=3Dstring.atoi(v)
             except: raise 'Invalid value for -i option', v
             sys.setcheckinterval(v)
=20
@@ -430,14 +452,12 @@
             DEBUG=3D1
         elif o=3D=3D'-S': sys.ZMANAGED=3D1
         elif o=3D=3D'-X':
-            =
MONITOR_PORT=3DHTTP_PORT=3DFTP_PORT=3DFCGI_PORT=3DICP_PORT=3D0
+            MONITOR_PORT=3DHTTP_PORT=3DFTP_PORT=3DFCGI_PORT=3D0
             PCGI_FILE=3D''
         elif o=3D=3D'-m':
             MONITOR_PORT=3Dserver_info(MONITOR_PORT, v)
         elif o=3D=3D'-w':
             HTTP_PORT=3Dserver_info(HTTP_PORT, v)
-        elif o=3D=3D'-C' or o=3D=3D'--force-http-connection-close':
-            FORCE_HTTP_CONNECTION_CLOSE=3D1
         elif o=3D=3D'-W':
             WEBDAV_SOURCE_PORT=3Dserver_info(WEBDAV_SOURCE_PORT, v)
         elif o=3D=3D'-f':
@@ -445,8 +465,6 @@
         elif o=3D=3D'-P':
             HTTP_PORT=3Dserver_info(HTTP_PORT, v, 80)
             FTP_PORT=3Dserver_info(FTP_PORT, v, 21)
-        elif o=3D=3D'--icp':
-            ICP_PORT=3Dserver_info(ICP_PORT, v)
=20
         elif o=3D=3D'-p':
             if v=3D=3D'-': v=3D''
@@ -513,58 +531,34 @@
 if LOCALE_ID is not None:
     set_locale(LOCALE_ID)
=20
-import zdaemon
+
 # from this point forward we can use the zope logger
-# importing ZDaemon before importing ZServer causes ZServer logging
-# not to work.
=20
 # Import ZServer before we open the database or get at interesting
 # application code so that ZServer's asyncore gets to be the
 # official one. Also gets SOFTWARE_HOME, INSTANCE_HOME, and CLIENT_HOME
 import ZServer
=20
-# install signal handlers if on posix
-if os.name =3D=3D 'posix':
-    from Signals import Signals
-    Signals.registerZopeSignals()
-
 if Zpid and not READ_ONLY:
-    import App.FindHomes
+    import zdaemon, App.FindHomes, posix
     sys.ZMANAGED=3D1
-    # zdaemon.run creates a process which "manages" the actual Zope
-    # process (restarts it if it dies).  The management process passes =
along
-    # signals that it receives to its child.
+   =20
     zdaemon.run(sys.argv, os.path.join(CLIENT_HOME, Zpid))
=20
-os.chdir(CLIENT_HOME)
-
-def _warn_nobody():
-    zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise =
"
-                               "your Zope files; consider using a "
-                               "dedicated user account for Zope") )
-
 try:
     # Import logging support
     import zLOG
     import ZLogger
=20
     if READ_ONLY:
-        if hasattr(zLOG, '_set_stupid_dest'):
-            zLOG._set_stupid_dest(sys.stderr)
-        else:
-            zLOG._stupid_dest =3D sys.stderr
+        zLOG._stupid_dest=3Dsys.stderr
     else:
         zLOG.log_write =3D ZLogger.ZLogger.log_write
=20
     if DETAILED_LOG_FILE:
         from ZServer import DebugLogger
         logfile=3Dos.path.join(CLIENT_HOME, DETAILED_LOG_FILE)
-        zLOG.LOG('z2', zLOG.BLATHER,
-                 'Using detailed request log file %s' % logfile)
-        DL=3DDebugLogger.DebugLogger(logfile)
-        DebugLogger.log=3DDL.log
-        DebugLogger.reopen=3DDL.reopen
-        sys.__detailedlog=3DDL
+        DebugLogger.log=3DDebugLogger.DebugLogger(logfile).log
=20
     # Import Zope (or Main)
     exec "import "+MODULE in {}
@@ -608,47 +602,28 @@
=20
     if READ_ONLY:
         lg =3D logger.file_logger('-') # log to stdout
-        zLOG.LOG('z2', zLOG.BLATHER, 'Logging access log to stdout')
-    elif os.environ.has_key('ZSYSLOG_ACCESS'):
-        if os.environ.has_key("ZSYSLOG_ACCESS_FACILITY"):
-            lg =3D logger.syslog_logger(
-                os.environ['ZSYSLOG_ACCESS'],
-                facility=3Dos.environ['ZSYSLOG_ACCESS_FACILITY'])
+    elif os.environ.has_key('ZSYSLOG'):
+        lg =3D logger.syslog_logger(os.environ['ZSYSLOG'])
+        if os.environ.has_key("ZSYSLOG_FACILITY"):
+            lg =3D =
logger.syslog_logger(os.environ['ZSYSLOG'],facility=3Dos.environ['ZSYSLOG=
_FACILITY'])
         else:
-            lg =3D logger.syslog_logger(os.environ['ZSYSLOG_ACCESS'])
-        zLOG.LOG('z2', zLOG.BLATHER, 'Using local syslog access log')
-    elif os.environ.has_key('ZSYSLOG_ACCESS_SERVER'):
-        (addr, port) =3D os.environ['ZSYSLOG_ACCESS_SERVER'].split( =
':')
+            lg =3D logger.syslog_logger(os.environ['ZSYSLOG'])
+    elif os.environ.has_key('ZSYSLOG_SERVER'):
+        (addr, port) =3D string.split(os.environ['ZSYSLOG_SERVER'], =
':')
         lg =3D logger.syslog_logger((addr, int(port)))
-        zLOG.LOG('z2', zLOG.BLATHER, 'Using remote syslog access log')
     else:
         lg =3D logger.file_logger(LOG_PATH)
-        zLOG.LOG('z2', zLOG.BLATHER, 'Using access log file %s' % =
LOG_PATH)
-    sys.__lg =3D lg
-
-    port_err=3D('\n\nZope wants to use %(socktype)s port %(port)s for =
its '
-              '%(protocol)s service, but it is already in use by =
another '
-              'application on this machine.  Either shut the =
application down '
-              'which is using this port, or start Zope with a different =
'
-              '%(protocol)s port via the "%(switch)s" command-line =
switch.\n')
=20
     # HTTP Server
     if HTTP_PORT:
-        if isinstance(HTTP_PORT, IntType): HTTP_PORT=3D((IP_ADDRESS, =
HTTP_PORT),)
+        if type(HTTP_PORT) is type(0): HTTP_PORT=3D((IP_ADDRESS, =
HTTP_PORT),)
         for address, port in HTTP_PORT:
-            try:
-                hs =3D zhttp_server(
-                    ip=3Daddress,
-                    port=3Dport,
-                    resolver=3Drs,
-                    logger_object=3Dlg)
-            except socket.error, why:
-                if why[0] =3D=3D 98: # address in use
-                    raise port_err % {'port':port,
-                                      'socktype':'TCP',
-                                      'protocol':'HTTP',
-                                      'switch':'-w'}
-                raise
+            hs =3D zhttp_server(
+                ip=3Daddress,
+                port=3Dport,
+                resolver=3Drs,
+                logger_object=3Dlg)
+
             # Handler for a published module. zhttp_handler takes 3 =
arguments:
             # The name of the module to publish, and optionally the URI =
base
             # which is basically the SCRIPT_NAME, and optionally a =
dictionary
@@ -658,31 +633,21 @@
             # environment setting is useful when you want to proxy =
requests
             # from another web server to ZServer, and would like the =
CGI
             # environment to reflect the CGI environment of the other =
web
-            # server.
+            # server.   =20
             zh =3D zhttp_handler(MODULE, '', HTTP_ENV)
-            if FORCE_HTTP_CONNECTION_CLOSE:
-                zh._force_connection_close =3D 1
             hs.install_handler(zh)
=20
     # WebDAV source Server (runs HTTP, but munges request to return
     #  'manage_FTPget').
     if WEBDAV_SOURCE_PORT:
-        if isinstance(WEBDAV_SOURCE_PORT, IntType):
+        if type(WEBDAV_SOURCE_PORT) is type(0):
             WEBDAV_SOURCE_PORT=3D((IP_ADDRESS, WEBDAV_SOURCE_PORT),)
         for address, port in WEBDAV_SOURCE_PORT:
-            try:
-                hs =3D zhttp_server(
-                    ip=3Daddress,
-                    port=3Dport,
-                    resolver=3Drs,
-                    logger_object=3Dlg)
-            except socket.error, why:
-                if why[0] =3D=3D 98: # address in use
-                    raise port_err % {'port':port,
-                                      'socktype':'TCP',
-                                      'protocol':'WebDAV source',
-                                      'switch':'-W'}
-                raise
+            hs =3D zhttp_server(
+                ip=3Daddress,
+                port=3Dport,
+                resolver=3Drs,
+                logger_object=3Dlg)
=20
             # Handler for a published module. zhttp_handler takes 3 =
arguments:
             # The name of the module to publish, and optionally the URI =
base
@@ -693,39 +658,20 @@
             # environment setting is useful when you want to proxy =
requests
             # from another web server to ZServer, and would like the =
CGI
             # environment to reflect the CGI environment of the other =
web
-            # server.
+            # server.   =20
             zh =3D WebDAVSrcHandler(MODULE, '', HTTP_ENV)
             hs.install_handler(zh)
=20
-            # enable document retrieval of the document source on the
-            # standard HTTP port
-
-            clients =3D os.environ.get('WEBDAV_SOURCE_PORT_CLIENTS')
-            if clients:
-                import re
-                sys.WEBDAV_SOURCE_PORT_CLIENTS =3D =
re.compile(clients).search
-            else:
-                sys.WEBDAV_SOURCE_PORT_CLIENTS =3D None
-
-
     # FTP Server
     if FTP_PORT:
-        if isinstance(FTP_PORT, IntType): FTP_PORT=3D((IP_ADDRESS, =
FTP_PORT),)
+        if type(FTP_PORT) is type(0): FTP_PORT=3D((IP_ADDRESS, =
FTP_PORT),)
         for address, port in FTP_PORT:
-            try:
-                FTPServer(
-                   module=3DMODULE,
-                   ip=3Daddress,
-                   port=3Dport,
-                   resolver=3Drs,
-                   logger_object=3Dlg)
-            except socket.error, why:
-                if why[0] =3D=3D 98: # address in use
-                    raise port_err % {'port':port,
-                                      'socktype':'TCP',
-                                      'protocol':'FTP',
-                                      'switch':'-f'}
-                raise
+            FTPServer(
+               module=3DMODULE,
+               ip=3Daddress,
+               port=3Dport,
+               resolver=3Drs,
+               logger_object=3Dlg)
=20
     # PCGI Server
     if PCGI_FILE and not READ_ONLY:
@@ -744,23 +690,15 @@
         fcgiPort =3D None
         fcgiPath =3D None
         try:
-            fcgiPort =3D int(FCGI_PORT)
+            fcgiPort =3D string.atoi(FCGI_PORT)
         except ValueError:
             fcgiPath =3D FCGI_PORT
-        try:
-            zfcgi =3D FCGIServer(module=3DMODULE,
-                               ip=3DIP_ADDRESS,
-                               port=3DfcgiPort,
-                               socket_file=3DfcgiPath,
-                               resolver=3Drs,
-                               logger_object=3Dlg)
-        except socket.error, why:
-            if why[0] =3D=3D 98: # address in use
-                raise port_err % {'port':fcgiPort,
-                                  'socktype':'TCP',
-                                  'protocol':'FastCGI',
-                                  'switch':'-F'}
-            raise
+        zfcgi =3D FCGIServer(module=3DMODULE,
+                           ip=3DIP_ADDRESS,
+                           port=3DfcgiPort,
+                           socket_file=3DfcgiPath,
+                           resolver=3Drs,
+                           logger_object=3Dlg)
=20
=20
     # Monitor Server
@@ -773,122 +711,55 @@
             zLOG.LOG("z2", zLOG.WARNING, 'Monitor server not started'
                      ' because no emergency user exists.')
         if pw:
-            if isinstance(MONITOR_PORT, IntType):
+            if type(MONITOR_PORT) is type(0):=20
                 MONITOR_PORT=3D((IP_ADDRESS, MONITOR_PORT),)
             for address, port in MONITOR_PORT:
-                try:
-                    monitor=3Dsecure_monitor_server(
-                        password=3Dpw,
-                        hostname=3Daddress,
-                        port=3Dport)
-                except socket.error, why:
-                    if why[0] =3D=3D 98: # address in use
-                        raise port_err % {'port':port,
-                                          'socktype':'TCP',
-                                          'protocol':'monitor server',
-                                          'switch':'-m'}
-                    raise
-
-    if ICP_PORT:
-        if isinstance(ICP_PORT, IntType): ICP_PORT=3D((IP_ADDRESS, =
ICP_PORT),)
-        from ZServer.ICPServer import ICPServer
-        for address, port in ICP_PORT:
+                monitor=3Dsecure_monitor_server(
+                    password=3Dpw,
+                    hostname=3Daddress,
+                    port=3Dport)
+
+    # Try to set uid to "-u" -provided uid.
+    # Try to set gid to  "-u" user's primary group.=20
+    # This will only work if this script is run by root.
+    try:
+        import pwd
+        try:
+            try:    UID =3D string.atoi(UID)
+            except: pass
+            gid =3D None
+            if type(UID) =3D=3D type(""):
+                uid =3D pwd.getpwnam(UID)[2]
+                gid =3D pwd.getpwnam(UID)[3]
+            elif type(UID) =3D=3D type(1):
+                uid =3D pwd.getpwuid(UID)[2]
+                gid =3D pwd.getpwuid(UID)[3]
+            else:
+                raise KeyError=20
             try:
-                ICPServer(address,port)
-            except socket.error, why:
-                if why[0] =3D=3D 98: # address in use
-                    raise port_err % {'port':port,
-                                      'socktype':'UDP',
-                                      'protocol':'ICP',
-                                      'switch':'--icp'}
-                raise
+                if gid is not None:
+                    try:
+                        os.setgid(gid)
+                    except OSError:
+                        pass
+                os.setuid(uid)
+            except OSError:
+                pass
+        except KeyError:
+            zLOG.LOG("z2", zLOG.ERROR, ("can't find UID %s" % UID))
+    except:
+        pass
+
+
=20
+    # if it hasn't failed at this point, create a .pid file.
     if not READ_ONLY:
-        if os.path.exists(PID_FILE): os.unlink(PID_FILE)
         pf =3D open(PID_FILE, 'w')
         pid=3Dstr(os.getpid())
         try: pid=3Dstr(os.getppid())+' '+pid
         except: pass
         pf.write(pid)
         pf.close()
-
-    # Warn if we were started as nobody.
-    try:
-        import pwd
-        if os.getuid():
-            if pwd.getpwuid(os.getuid())[0] =3D=3D 'nobody':
-                _warn_nobody()
-    except:
-        pass
-
-    # Drop root privileges if we have them, and do some sanity checking
-    # to make sure we're not starting with an obviously insecure setup.
-    try:
-        if os.getuid() =3D=3D 0:
-            try:
-                import initgroups
-            except:
-                raise SystemExit, 'initgroups is required to safely =
setuid'
-            if UID =3D=3D None:
-                raise SystemExit, ('A user was not specified to setuid =
'
-                                   'to; fix this to start as root (see =
'
-                                   'doc/SETUID.txt)')
-            import stat
-            client_home_stat =3D os.stat(CLIENT_HOME)
-            client_home_faults =3D []
-            if not (client_home_stat[stat.ST_MODE]&01000):
-                client_home_faults.append('does not have the sticky bit =
set')
-            if client_home_stat[stat.ST_UID] !=3D 0:
-                client_home_faults.append('is not owned by root')
-            if client_home_faults:
-                client_home_faults.append('fix this to start as root =
(see '
-                                          'doc/SETUID.txt)')
-                err =3D '%s %s' % (CLIENT_HOME, ', =
'.join(client_home_faults))
-                raise SystemExit, err
-
-            try:
-                try:    UID =3D string.atoi(UID)
-                except: pass
-                gid =3D None
-                if isinstance(UID, StringType):
-                    uid =3D pwd.getpwnam(UID)[2]
-                    gid =3D pwd.getpwnam(UID)[3]
-                elif isinstance(UID, IntType):
-                    uid =3D pwd.getpwuid(UID)[2]
-                    gid =3D pwd.getpwuid(UID)[3]
-                    UID =3D pwd.getpwuid(UID)[0]
-                else:
-                    raise KeyError
-                if UID =3D=3D 'nobody':
-                    _warn_nobody()
-                try:
-                    initgroups.initgroups(UID, gid)
-                    if gid is not None:
-                        try:
-                            os.setgid(gid)
-                        except OSError:
-                            pass
-                    os.setuid(uid)
-                except OSError:
-                    pass
-            except KeyError:
-                zLOG.LOG("z2", zLOG.ERROR, ("Can't find UID %s" % UID))
-    except AttributeError:
-        pass
-    except:
-        raise
-
-    # Check umask sanity if we're on posix.
-    if os.name =3D=3D 'posix':
-        # umask is silly, blame POSIX.  We have to set it to get its =
value.
-        current_umask =3D os.umask(0)
-        os.umask(current_umask)
-        if current_umask !=3D 077:
-            current_umask =3D '%03o' % current_umask
-            zLOG.LOG("z2", zLOG.INFO, (
-                'Your umask of %s may be too permissive; for the =
security of '
-                'your Zope data, it is recommended you use 077' % =
current_umask
-                ))
=20
 except:
     # Log startup exception and tell zdaemon not to restart us.

------=_NextPart_000_0115_01C263EB.D77AF860--