]> granicus.if.org Git - python/commitdiff
Updated all import statements to use the new socketserver module name.
authorAlexandre Vassalotti <alexandre@peadrop.com>
Mon, 12 May 2008 02:11:22 +0000 (02:11 +0000)
committerAlexandre Vassalotti <alexandre@peadrop.com>
Mon, 12 May 2008 02:11:22 +0000 (02:11 +0000)
Renamed socketserver module in its own documentation.
Renamed documentation references.

14 files changed:
Doc/library/basehttpserver.rst
Doc/library/logging.rst
Doc/library/simplexmlrpcserver.rst
Doc/library/socket.rst
Doc/library/socketserver.rst
Lib/BaseHTTPServer.py
Lib/SimpleXMLRPCServer.py
Lib/idlelib/rpc.py
Lib/logging/config.py
Lib/test/test___all__.py
Lib/test/test_logging.py
Lib/test/test_socketserver.py
Lib/test/test_wsgiref.py
Misc/cheatsheet

index 0fbf8b0687dfab2ad8fa5f98e359171303891548..7d5061343839338add837dba7220f93495512199 100644 (file)
@@ -21,7 +21,7 @@ Usually, this module isn't used directly, but is used as a basis for building
 functioning Web servers. See the :mod:`SimpleHTTPServer` and
 :mod:`CGIHTTPServer` modules.
 
-The first class, :class:`HTTPServer`, is a :class:`SocketServer.TCPServer`
+The first class, :class:`HTTPServer`, is a :class:`socketserver.TCPServer`
 subclass.  It creates and listens at the HTTP socket, dispatching the requests
 to a handler.  Code to create and run the server looks like this::
 
index 1f7c59b06af9cc7b202ba843d20eaff9279fba25..371ece38d95bf4ea7456309212e8a31c67e3d1d0 100644 (file)
@@ -1299,17 +1299,17 @@ the receiving end. A simple way of doing this is attaching a
    logger2.warning('Jail zesty vixen who grabbed pay from quack.')
    logger2.error('The five boxing wizards jump quickly.')
 
-At the receiving end, you can set up a receiver using the :mod:`SocketServer`
+At the receiving end, you can set up a receiver using the :mod:`socketserver`
 module. Here is a basic working example::
 
    import cPickle
    import logging
    import logging.handlers
-   import SocketServer
+   import socketserver
    import struct
 
 
-   class LogRecordStreamHandler(SocketServer.StreamRequestHandler):
+   class LogRecordStreamHandler(socketserver.StreamRequestHandler):
        """Handler for a streaming logging request.
 
        This basically logs the record using whatever logging policy is
@@ -1351,7 +1351,7 @@ module. Here is a basic working example::
            # cycles and network bandwidth!
            logger.handle(record)
 
-   class LogRecordSocketReceiver(SocketServer.ThreadingTCPServer):
+   class LogRecordSocketReceiver(socketserver.ThreadingTCPServer):
        """simple TCP socket-based logging receiver suitable for testing.
        """
 
@@ -1360,7 +1360,7 @@ module. Here is a basic working example::
        def __init__(self, host='localhost',
                     port=logging.handlers.DEFAULT_TCP_LOGGING_PORT,
                     handler=LogRecordStreamHandler):
-           SocketServer.ThreadingTCPServer.__init__(self, (host, port), handler)
+           socketserver.ThreadingTCPServer.__init__(self, (host, port), handler)
            self.abort = 0
            self.timeout = 1
            self.logname = None
index c788d55d571199c88e1ac285837d28d2c7cecb90..d434210d66ba014300e3259817316c8f77afda0f 100644 (file)
@@ -22,7 +22,7 @@ XML-RPC servers written in Python.  Servers can either be free standing, using
    functions that can be called by the XML-RPC protocol.  The *requestHandler*
    parameter should be a factory for request handler instances; it defaults to
    :class:`SimpleXMLRPCRequestHandler`.  The *addr* and *requestHandler* parameters
-   are passed to the :class:`SocketServer.TCPServer` constructor.  If *logRequests*
+   are passed to the :class:`socketserver.TCPServer` constructor.  If *logRequests*
    is true (the default), requests will be logged; setting this parameter to false
    will turn off logging.   The *allow_none* and *encoding* parameters are passed
    on to  :mod:`xmlrpclib` and control the XML-RPC responses that will be returned
@@ -63,7 +63,7 @@ SimpleXMLRPCServer Objects
 --------------------------
 
 The :class:`SimpleXMLRPCServer` class is based on
-:class:`SocketServer.TCPServer` and provides a means of creating simple, stand
+:class:`socketserver.TCPServer` and provides a means of creating simple, stand
 alone XML-RPC servers.
 
 
index e5a8167a637c3c58ed430277309e4980085b03b1..d05120ebdd765dbabddef65c6d7c1eed2702a28b 100644 (file)
@@ -481,7 +481,7 @@ The module :mod:`socket` exports the following constants and functions:
 
 .. seealso::
 
-   Module :mod:`SocketServer`
+   Module :mod:`socketserver`
       Classes that simplify writing network servers.
 
 
index 4163a8f581f5029bac866e21e3e51a20b162fa61..e24b4296bc781b01f31a1284f618581e78faa18f 100644 (file)
@@ -1,12 +1,11 @@
 
-:mod:`SocketServer` --- A framework for network servers
+:mod:`socketserver` --- A framework for network servers
 =======================================================
 
-.. module:: SocketServer
+.. module:: socketserver
    :synopsis: A framework for network servers.
 
-
-The :mod:`SocketServer` module simplifies the task of writing network servers.
+The :mod:`socketserver` module simplifies the task of writing network servers.
 
 There are four basic server classes: :class:`TCPServer` uses the Internet TCP
 protocol, which provides for continuous streams of data between the client and
@@ -213,7 +212,7 @@ server classes like :class:`TCPServer`; these methods aren't useful to external
 users of the server object.
 
 .. XXX should the default implementations of these be documented, or should
-   it be assumed that the user will look at SocketServer.py?
+   it be assumed that the user will look at socketserver.py?
 
 
 .. function:: finish_request()
index 97d800cb390b5ab914f2e13274833e4b80403214..4f3d27adf8e910c52b2f7af9e60b0e286237d8f5 100644 (file)
@@ -74,7 +74,7 @@ import sys
 import time
 import socket # For gethostbyaddr()
 import mimetools
-import SocketServer
+import socketserver
 
 # Default error message template
 DEFAULT_ERROR_MESSAGE = """\
@@ -94,19 +94,19 @@ DEFAULT_ERROR_CONTENT_TYPE = "text/html"
 def _quote_html(html):
     return html.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
 
-class HTTPServer(SocketServer.TCPServer):
+class HTTPServer(socketserver.TCPServer):
 
     allow_reuse_address = 1    # Seems to make sense in testing environment
 
     def server_bind(self):
         """Override server_bind to store the server name."""
-        SocketServer.TCPServer.server_bind(self)
+        socketserver.TCPServer.server_bind(self)
         host, port = self.socket.getsockname()[:2]
         self.server_name = socket.getfqdn(host)
         self.server_port = port
 
 
-class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
+class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
 
     """HTTP request handler base class.
 
index 5fad0af4a344bbdbdbd5e445712d7c44923341bd..353542aee2562df3c3151ce3ec87e29ba0f69d9e 100644 (file)
@@ -101,7 +101,7 @@ server.handle_request()
 
 import xmlrpclib
 from xmlrpclib import Fault
-import SocketServer
+import socketserver
 import BaseHTTPServer
 import sys
 import os
@@ -512,7 +512,7 @@ class SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
         if self.server.logRequests:
             BaseHTTPServer.BaseHTTPRequestHandler.log_request(self, code, size)
 
-class SimpleXMLRPCServer(SocketServer.TCPServer,
+class SimpleXMLRPCServer(socketserver.TCPServer,
                          SimpleXMLRPCDispatcher):
     """Simple XML-RPC server.
 
@@ -536,7 +536,7 @@ class SimpleXMLRPCServer(SocketServer.TCPServer,
         self.logRequests = logRequests
 
         SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding)
-        SocketServer.TCPServer.__init__(self, addr, requestHandler, bind_and_activate)
+        socketserver.TCPServer.__init__(self, addr, requestHandler, bind_and_activate)
 
         # [Bug #1222790] If possible, set close-on-exec flag; if a
         # method spawns a subprocess, the subprocess shouldn't have
index 7d36b2a54de2329556552d91d2e073f6528fb238..a8c6afb02f6ad9bbb44fd6cc7a8331b3bb40a23a 100644 (file)
@@ -5,7 +5,7 @@ connect to the Idle process, which listens for the connection.  Since Idle has
 has only one client per server, this was not a limitation.
 
    +---------------------------------+ +-------------+
-   | SocketServer.BaseRequestHandler | | SocketIO    |
+   | socketserver.BaseRequestHandler | | SocketIO    |
    +---------------------------------+ +-------------+
                    ^                   | register()  |
                    |                   | unregister()|
@@ -31,7 +31,7 @@ import sys
 import os
 import socket
 import select
-import SocketServer
+import socketserver
 import struct
 import cPickle as pickle
 import threading
@@ -66,12 +66,12 @@ copyreg.pickle(types.CodeType, pickle_code, unpickle_code)
 BUFSIZE = 8*1024
 LOCALHOST = '127.0.0.1'
 
-class RPCServer(SocketServer.TCPServer):
+class RPCServer(socketserver.TCPServer):
 
     def __init__(self, addr, handlerclass=None):
         if handlerclass is None:
             handlerclass = RPCHandler
-        SocketServer.TCPServer.__init__(self, addr, handlerclass)
+        socketserver.TCPServer.__init__(self, addr, handlerclass)
 
     def server_bind(self):
         "Override TCPServer method, no bind() phase for connecting entity"
@@ -492,7 +492,7 @@ class RemoteProxy(object):
     def __init__(self, oid):
         self.oid = oid
 
-class RPCHandler(SocketServer.BaseRequestHandler, SocketIO):
+class RPCHandler(socketserver.BaseRequestHandler, SocketIO):
 
     debugging = False
     location = "#S"  # Server
@@ -500,10 +500,10 @@ class RPCHandler(SocketServer.BaseRequestHandler, SocketIO):
     def __init__(self, sock, addr, svr):
         svr.current_handler = self ## cgt xxx
         SocketIO.__init__(self, sock)
-        SocketServer.BaseRequestHandler.__init__(self, sock, addr, svr)
+        socketserver.BaseRequestHandler.__init__(self, sock, addr, svr)
 
     def handle(self):
-        "handle() method required by SocketServer"
+        "handle() method required by socketserver"
         self.mainloop()
 
     def get_remote_proxy(self, oid):
index c95842c7d9994bc5f2ce12d4ce17b2936b80c0bf..33d6f2f27a5be4858db929227862a43bb5fef4ba 100644 (file)
@@ -35,7 +35,7 @@ try:
 except ImportError:
     thread = None
 
-from SocketServer import ThreadingTCPServer, StreamRequestHandler
+from socketserver import ThreadingTCPServer, StreamRequestHandler
 
 
 DEFAULT_LOGGING_CONFIG_PORT = 9030
index 9c5e1f31983e0af8e6e711df6f3c47c22dad0e84..8d3e9eea438740bdf83bb1504b30271b82649e26 100644 (file)
@@ -42,7 +42,7 @@ class AllTest(unittest.TestCase):
         self.check_all("MimeWriter")
         self.check_all("Queue")
         self.check_all("SimpleHTTPServer")
-        self.check_all("SocketServer")
+        self.check_all("socketserver")
         self.check_all("StringIO")
         self.check_all("UserString")
         self.check_all("aifc")
index b937411c038ca2d97db2c5d072549f656604220a..97e1af38a7fb2d77d0ff41b03d13e837906f917b 100644 (file)
@@ -33,7 +33,7 @@ import os
 import re
 import select
 import socket
-from SocketServer import ThreadingTCPServer, StreamRequestHandler
+from socketserver import ThreadingTCPServer, StreamRequestHandler
 import string
 import struct
 import sys
index 8595e5a2456710df413b79e6f8b7336b3053d49e..4e26e7b4d91b62dbab05fea06111600f304ee6a6 100644 (file)
@@ -1,5 +1,5 @@
 """
-Test suite for SocketServer.py.
+Test suite for socketserver.
 """
 
 import contextlib
@@ -13,7 +13,7 @@ import tempfile
 import threading
 import time
 import unittest
-import SocketServer
+import socketserver
 
 import test.test_support
 from test.test_support import reap_children, verbose, TestSkipped
@@ -40,12 +40,12 @@ def receive(sock, n, timeout=20):
         raise RuntimeError, "timed out on %r" % (sock,)
 
 if HAVE_UNIX_SOCKETS:
-    class ForkingUnixStreamServer(SocketServer.ForkingMixIn,
-                                  SocketServer.UnixStreamServer):
+    class ForkingUnixStreamServer(socketserver.ForkingMixIn,
+                                  socketserver.UnixStreamServer):
         pass
 
-    class ForkingUnixDatagramServer(SocketServer.ForkingMixIn,
-                                    SocketServer.UnixDatagramServer):
+    class ForkingUnixDatagramServer(socketserver.ForkingMixIn,
+                                    socketserver.UnixDatagramServer):
         pass
 
 
@@ -172,55 +172,55 @@ class SocketServerTest(unittest.TestCase):
         s.close()
 
     def test_TCPServer(self):
-        self.run_server(SocketServer.TCPServer,
-                        SocketServer.StreamRequestHandler,
+        self.run_server(socketserver.TCPServer,
+                        socketserver.StreamRequestHandler,
                         self.stream_examine)
 
     def test_ThreadingTCPServer(self):
-        self.run_server(SocketServer.ThreadingTCPServer,
-                        SocketServer.StreamRequestHandler,
+        self.run_server(socketserver.ThreadingTCPServer,
+                        socketserver.StreamRequestHandler,
                         self.stream_examine)
 
     if HAVE_FORKING:
         def test_ForkingTCPServer(self):
             with simple_subprocess(self):
-                self.run_server(SocketServer.ForkingTCPServer,
-                                SocketServer.StreamRequestHandler,
+                self.run_server(socketserver.ForkingTCPServer,
+                                socketserver.StreamRequestHandler,
                                 self.stream_examine)
 
     if HAVE_UNIX_SOCKETS:
         def test_UnixStreamServer(self):
-            self.run_server(SocketServer.UnixStreamServer,
-                            SocketServer.StreamRequestHandler,
+            self.run_server(socketserver.UnixStreamServer,
+                            socketserver.StreamRequestHandler,
                             self.stream_examine)
 
         def test_ThreadingUnixStreamServer(self):
-            self.run_server(SocketServer.ThreadingUnixStreamServer,
-                            SocketServer.StreamRequestHandler,
+            self.run_server(socketserver.ThreadingUnixStreamServer,
+                            socketserver.StreamRequestHandler,
                             self.stream_examine)
 
         if HAVE_FORKING:
             def test_ForkingUnixStreamServer(self):
                 with simple_subprocess(self):
                     self.run_server(ForkingUnixStreamServer,
-                                    SocketServer.StreamRequestHandler,
+                                    socketserver.StreamRequestHandler,
                                     self.stream_examine)
 
     def test_UDPServer(self):
-        self.run_server(SocketServer.UDPServer,
-                        SocketServer.DatagramRequestHandler,
+        self.run_server(socketserver.UDPServer,
+                        socketserver.DatagramRequestHandler,
                         self.dgram_examine)
 
     def test_ThreadingUDPServer(self):
-        self.run_server(SocketServer.ThreadingUDPServer,
-                        SocketServer.DatagramRequestHandler,
+        self.run_server(socketserver.ThreadingUDPServer,
+                        socketserver.DatagramRequestHandler,
                         self.dgram_examine)
 
     if HAVE_FORKING:
         def test_ForkingUDPServer(self):
             with simple_subprocess(self):
-                self.run_server(SocketServer.ForkingUDPServer,
-                                SocketServer.DatagramRequestHandler,
+                self.run_server(socketserver.ForkingUDPServer,
+                                socketserver.DatagramRequestHandler,
                                 self.dgram_examine)
 
     # Alas, on Linux (at least) recvfrom() doesn't return a meaningful
@@ -228,19 +228,19 @@ class SocketServerTest(unittest.TestCase):
 
     # if HAVE_UNIX_SOCKETS:
     #     def test_UnixDatagramServer(self):
-    #         self.run_server(SocketServer.UnixDatagramServer,
-    #                         SocketServer.DatagramRequestHandler,
+    #         self.run_server(socketserver.UnixDatagramServer,
+    #                         socketserver.DatagramRequestHandler,
     #                         self.dgram_examine)
     #
     #     def test_ThreadingUnixDatagramServer(self):
-    #         self.run_server(SocketServer.ThreadingUnixDatagramServer,
-    #                         SocketServer.DatagramRequestHandler,
+    #         self.run_server(socketserver.ThreadingUnixDatagramServer,
+    #                         socketserver.DatagramRequestHandler,
     #                         self.dgram_examine)
     #
     #     if HAVE_FORKING:
     #         def test_ForkingUnixDatagramServer(self):
-    #             self.run_server(SocketServer.ForkingUnixDatagramServer,
-    #                             SocketServer.DatagramRequestHandler,
+    #             self.run_server(socketserver.ForkingUnixDatagramServer,
+    #                             socketserver.DatagramRequestHandler,
     #                             self.dgram_examine)
 
 
index b6d994b03d413f2debbc9137ea7d6c177f94bfab..e30990ef314318cde7552e8bb48d6d5144643e9d 100755 (executable)
@@ -8,7 +8,7 @@ from wsgiref.validate import validator
 from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, demo_app
 from wsgiref.simple_server import make_server
 from StringIO import StringIO
-from SocketServer import BaseServer
+from socketserver import BaseServer
 import re, sys
 
 from test import test_support
index 605084aca856df84429c3eba9fdc8f6568ab7ed4..61217c4f4431fe6327f557ee125d30ea94ff0090 100644 (file)
@@ -1973,7 +1973,7 @@ site             Append module search paths for third-party packages to
                  sys.path.
 smtplib          SMTP Client class (RFC 821)
 sndhdr           Several routines that help recognizing sound.
-SocketServer     Generic socket server classes.
+socketserver     Generic socket server classes.
 stat             Constants and functions for interpreting stat/lstat struct.
 statcache        Maintain a cache of file stats.
 statvfs          Constants for interpreting statvfs struct as returned by
@@ -2271,5 +2271,3 @@ Breakpoints are stored as filename, line number tuples. If a module is reloaded
 after editing, any remembered breakpoints are likely to be wrong.
 
 Always single-steps through top-most stack frame. That is, "c" acts like "n".
-
-