socketserver renaming reversal part 3: move the module into the right
place and fix all references to it. Closes #2926.
diff --git a/Doc/library/basehttpserver.rst b/Doc/library/basehttpserver.rst
index 7d50613..0fbf8b0 100644
--- a/Doc/library/basehttpserver.rst
+++ b/Doc/library/basehttpserver.rst
@@ -21,7 +21,7 @@
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::
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst
index 6ece996..bca1ece 100644
--- a/Doc/library/logging.rst
+++ b/Doc/library/logging.rst
@@ -1299,17 +1299,17 @@
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 @@
# 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 @@
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
diff --git a/Doc/library/repr.rst b/Doc/library/repr.rst
index bd9743d..29c5a61 100644
--- a/Doc/library/repr.rst
+++ b/Doc/library/repr.rst
@@ -7,8 +7,9 @@
.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
.. note::
- The :mod:`repr` module has been renamed to :mod:`reprlib` in
- Python 3.0.
+ The :mod:`repr` module has been renamed to :mod:`reprlib` in Python 3.0. The
+ :term:`2to3` tool will automatically adapt imports when converting your
+ sources to 3.0.
The :mod:`repr` module provides a means for producing object representations
with limits on the size of the resulting strings. This is used in the Python
diff --git a/Doc/library/simplexmlrpcserver.rst b/Doc/library/simplexmlrpcserver.rst
index d434210..c788d55 100644
--- a/Doc/library/simplexmlrpcserver.rst
+++ b/Doc/library/simplexmlrpcserver.rst
@@ -22,7 +22,7 @@
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 @@
--------------------------
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.
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index d05120e..e5a8167 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -481,7 +481,7 @@
.. seealso::
- Module :mod:`socketserver`
+ Module :mod:`SocketServer`
Classes that simplify writing network servers.
diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst
index d06b2c2..51cab5e 100644
--- a/Doc/library/socketserver.rst
+++ b/Doc/library/socketserver.rst
@@ -1,19 +1,18 @@
-:mod:`socketserver` --- A framework for network servers
+
+:mod:`SocketServer` --- A framework for network servers
=======================================================
.. module:: SocketServer
- :synopsis: Old name for the socketserver module.
-
-.. module:: socketserver
:synopsis: A framework for network servers.
.. note::
- The :mod:`SocketServer` module has been renamed to :mod:`socketserver` in
- Python 3.0. It is importable under both names in Python 2.6 and the rest of
- the 2.x series.
+
+ The :mod:`SocketServer` module has been renamed to `socketserver` in Python
+ 3.0. The :term:`2to3` tool will automatically adapt imports when converting
+ your sources to 3.0.
-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
@@ -220,7 +219,7 @@
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()
@@ -325,14 +324,14 @@
Examples
--------
-:class:`socketserver.TCPServer` Example
+:class:`SocketServer.TCPServer` Example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the server side::
- import socketserver
+ import SocketServer
- class MyTCPHandler(socketserver.BaseRequestHandler):
+ class MyTCPHandler(SocketServer.BaseRequestHandler):
"""
The RequestHandler class for our server.
@@ -353,7 +352,7 @@
HOST, PORT = "localhost", 9999
# Create the server, binding to localhost on port 9999
- server = socketserver.TCPServer((HOST, PORT), MyTCPHandler)
+ server = SocketServer.TCPServer((HOST, PORT), MyTCPHandler)
# Activate the server; this will keep running until you
# interrupt the program with Ctrl-C
@@ -362,7 +361,7 @@
An alternative request handler class that makes use of streams (file-like
objects that simplify communication by providing the standard file interface)::
- class MyTCPHandler(socketserver.StreamRequestHandler):
+ class MyTCPHandler(SocketServer.StreamRequestHandler):
def handle(self):
# self.rfile is a file-like object created by the handler;
@@ -423,14 +422,14 @@
Received: PYTHON IS NICE
-:class:`socketserver.UDPServer` Example
+:class:`SocketServer.UDPServer` Example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the server side::
- import socketserver
+ import SocketServer
- class MyUDPHandler(socketserver.BaseRequestHandler):
+ class MyUDPHandler(SocketServer.BaseRequestHandler):
"""
This class works similar to the TCP handler class, except that
self.request consists of a pair of data and client socket, and since
@@ -447,7 +446,7 @@
if __name__ == "__main__":
HOST, PORT = "localhost", 9999
- server = socketserver.UDPServer((HOST, PORT), BaseUDPRequestHandler)
+ server = SocketServer.UDPServer((HOST, PORT), BaseUDPRequestHandler)
server.serve_forever()
This is the client side::
@@ -482,9 +481,9 @@
import socket
import threading
- import socketserver
+ import SocketServer
- class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
+ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
def handle(self):
data = self.request.recv(1024)
@@ -492,7 +491,7 @@
response = "%s: %s" % (cur_thread.getName(), data)
self.request.send(response)
- class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
+ class ThreadedTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
pass
def client(ip, port, message):