[Zope-Checkins] CVS: Zope/lib/python/App - ApplicationManager.py:1.87

Chris McDonough chrism@zope.com
Thu, 13 Mar 2003 17:19:04 -0500


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

Modified Files:
	ApplicationManager.py 
Log Message:
Make Control_Panel show network services.


=== Zope/lib/python/App/ApplicationManager.py 1.86 => 1.87 ===
--- Zope/lib/python/App/ApplicationManager.py:1.86	Tue Feb 11 12:17:04 2003
+++ Zope/lib/python/App/ApplicationManager.py	Thu Mar 13 17:18:33 2003
@@ -437,6 +437,21 @@
     def getCLIENT_HOME(self):
         return getConfiguration().clienthome
 
+    def getServers(self):
+        # used only for display purposes
+        # return a sequence of two-tuples.  The first element of
+        # each tuple is the service name, the second is a string repr. of
+        # the port/socket/other on which it listens
+        from asyncore import socket_map
+        l = []
+        for k,v in socket_map.items():
+            # this is only an approximation
+            if hasattr(v, 'port'):
+                type = str(getattr(v, '__class__', 'unknown'))
+                port = v.port
+                l.append((str(type), 'Port: %s' % port))
+        return l
+
     def objectIds(self, spec=None):
         """ this is a patch for pre-2.4 Zope installations. Such
             installations don't have an entry for the WebDAV LockManager