[Zope3-checkins] SVN: Zope3/branches/3.2/src/zope/app/twisted/ merge revision 40779 from trunk.

Gary Poster gary at zope.com
Wed Dec 14 13:49:10 EST 2005


Log message for revision 40780:
  merge revision 40779 from trunk.
  
  

Changed:
  U   Zope3/branches/3.2/src/zope/app/twisted/README.txt
  U   Zope3/branches/3.2/src/zope/app/twisted/server.py

-=-
Modified: Zope3/branches/3.2/src/zope/app/twisted/README.txt
===================================================================
--- Zope3/branches/3.2/src/zope/app/twisted/README.txt	2005-12-14 18:32:34 UTC (rev 40779)
+++ Zope3/branches/3.2/src/zope/app/twisted/README.txt	2005-12-14 18:49:09 UTC (rev 40780)
@@ -143,17 +143,25 @@
     >>> sf = ServerFactory(my_section)
 
 The server factory object knows how to create a server, given a ZODB database
-object.
+object.  The name is a combination of type, ip, and port, so that the Twisted
+code can distinguish between the different HTTP servers.
 
     >>> db = 'my db'
     >>> print sf.create(db)
-    HTTP server on *:8080, registered with my db, backlog 30
+    HTTP:localhost:8080 server on *:8080, registered with my db, backlog 30
 
+It can create more than one, using different ports.
+
+    >>> my_section.address = ('', 8081)
+    >>> sf = ServerFactory(my_section)
+    >>> print sf.create(db)
+    HTTP:localhost:8081 server on *:8081, registered with my db, backlog 30
+
 The settings should actually work with FTP as well.
 
     >>> my_section.type = 'FTP'
     >>> my_section.address = ('127.0.0.1', 8021)
     >>> sf = ServerFactory(my_section)
     >>> print sf.create(db)
-    FTP server on 127.0.0.1:8021, registered with my db, backlog 30
+    FTP:127.0.0.1:8021 server on 127.0.0.1:8021, registered with my db, backlog 30
 

Modified: Zope3/branches/3.2/src/zope/app/twisted/server.py
===================================================================
--- Zope3/branches/3.2/src/zope/app/twisted/server.py	2005-12-14 18:32:34 UTC (rev 40779)
+++ Zope3/branches/3.2/src/zope/app/twisted/server.py	2005-12-14 18:49:09 UTC (rev 40780)
@@ -150,12 +150,12 @@
         """Return a server based on the server types defined via ZCML."""
 
         servertype = zapi.getUtility(IServerType, self.type)
-
+        ip, port = self.address
         return servertype.create(
-            self.type,
+            '%s:%s:%d' % (self.type, ip or 'localhost', port),
             database,
-            ip=self.address[0],
-            port=self.address[1],
+            ip=ip,
+            port=port,
             backlog=self.backlog)
 
 



More information about the Zope3-Checkins mailing list