[Zope-Checkins] CVS: Zope/lib/python/ZServer - HTTPServer.py:1.46.2.5 datatypes.py:1.2.8.3

Sidnei da Silva sidnei at awkly.org
Fri May 20 13:39:53 EDT 2005


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

Modified Files:
      Tag: Zope-2_7-branch
	HTTPServer.py datatypes.py 
Log Message:

- Make it so webdav-source server is distinguishable from the default http server in the ZMI and event.log


=== Zope/lib/python/ZServer/HTTPServer.py 1.46.2.4 => 1.46.2.5 ===
--- Zope/lib/python/ZServer/HTTPServer.py:1.46.2.4	Wed Dec  1 18:01:48 2004
+++ Zope/lib/python/ZServer/HTTPServer.py	Fri May 20 13:39:52 2005
@@ -380,8 +380,8 @@
 class zhttp_server(http_server):
     "http server"
 
-    SERVER_IDENT='Zope/%s ZServer/%s' % (ZOPE_VERSION,ZSERVER_VERSION)
-
+    SERVER_IDENT = 'Zope/%s ZServer/%s' % (ZOPE_VERSION, ZSERVER_VERSION)
+    server_protocol = 'HTTP'
     channel_class = zhttp_channel
     shutup=0
 
@@ -389,16 +389,17 @@
         self.shutup=1
         http_server.__init__(self, ip, port, resolver, logger_object)
         self.shutup=0
-        self.log_info('HTTP server started at %s\n'
+        self.log_info('%s server started at %s\n'
                       '\tHostname: %s\n\tPort: %d' % (
-                        time.ctime(time.time()),
-                        self.server_name,
-                        self.server_port
-                        ))
+            self.server_protocol,
+            time.ctime(time.time()),
+            self.server_name,
+            self.server_port
+            ))
 
     def clean_shutdown_control(self,phase,time_in_this_phase):
         if phase==2:
-            self.log_info('closing HTTP to new connections')
+            self.log_info('closing %s to new connections' % self.server_protocol)
             self.close()
 
     def log_info(self, message, type='info'):
@@ -418,3 +419,6 @@
         # override asyncore limits for nt's listen queue size
         self.accepting = 1
         return self.socket.listen (num)
+
+class zwebdav_server(zhttp_server):
+    server_protocol = 'WebDAV'


=== Zope/lib/python/ZServer/datatypes.py 1.2.8.2 => 1.2.8.3 ===
--- Zope/lib/python/ZServer/datatypes.py:1.2.8.2	Fri May 28 02:13:23 2004
+++ Zope/lib/python/ZServer/datatypes.py	Fri May 20 13:39:53 2005
@@ -53,26 +53,27 @@
 
 class HTTPServerFactory(ServerFactory):
     def __init__(self, section):
+        from ZServer import HTTPServer
         if not section.address:
             raise ZConfig.ConfigurationError(
                 "No 'address' settings found "
                 "within the 'http-server' or 'webdav-source-server' section")
         ServerFactory.__init__(self, section.address)
+        self.server_class = HTTPServer.zhttp_server
         self.force_connection_close = section.force_connection_close
         # webdav-source-server sections won't have webdav_source_clients:
         webdav_clients = getattr(section, "webdav_source_clients", None)
         self.webdav_source_clients = webdav_clients
 
     def create(self):
-        from ZServer import HTTPServer
         from ZServer.AccessLogger import access_logger
         handler = self.createHandler()
         handler._force_connection_close = self.force_connection_close
         if self.webdav_source_clients:
             handler.set_webdav_source_clients(self.webdav_source_clients)
-        server = HTTPServer.zhttp_server(ip=self.host, port=self.port,
-                                         resolver=self.dnsresolver,
-                                         logger_object=access_logger)
+        server = self.server_class(ip=self.host, port=self.port,
+                                   resolver=self.dnsresolver,
+                                   logger_object=access_logger)
         server.install_handler(handler)
         return server
 
@@ -82,6 +83,11 @@
 
 
 class WebDAVSourceServerFactory(HTTPServerFactory):
+    def __init__(self, section):
+        from ZServer import HTTPServer
+        HTTPServerFactory.__init__(self, section)
+        self.server_class = HTTPServer.zwebdav_server
+
     def createHandler(self):
         from ZServer.WebDAVSrcHandler import WebDAVSrcHandler
         return WebDAVSrcHandler(self.module, '', self.cgienv)



More information about the Zope-Checkins mailing list