Skip to content

Commit 379c488

Browse files
author
georg.brandl
committed
socketserver renaming reversal part 3: move the module into the right
place and fix all references to it. Closes #2926. git-svn-id: http://svn.python.org/projects/python/trunk@63589 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent b43b92f commit 379c488

19 files changed

+409
-411
lines changed

Doc/library/basehttpserver.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Usually, this module isn't used directly, but is used as a basis for building
2121
functioning Web servers. See the :mod:`SimpleHTTPServer` and
2222
:mod:`CGIHTTPServer` modules.
2323

24-
The first class, :class:`HTTPServer`, is a :class:`socketserver.TCPServer`
24+
The first class, :class:`HTTPServer`, is a :class:`SocketServer.TCPServer`
2525
subclass. It creates and listens at the HTTP socket, dispatching the requests
2626
to a handler. Code to create and run the server looks like this::
2727

Doc/library/logging.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -1299,17 +1299,17 @@ the receiving end. A simple way of doing this is attaching a
12991299
logger2.warning('Jail zesty vixen who grabbed pay from quack.')
13001300
logger2.error('The five boxing wizards jump quickly.')
13011301

1302-
At the receiving end, you can set up a receiver using the :mod:`socketserver`
1302+
At the receiving end, you can set up a receiver using the :mod:`SocketServer`
13031303
module. Here is a basic working example::
13041304

13051305
import cPickle
13061306
import logging
13071307
import logging.handlers
1308-
import socketserver
1308+
import SocketServer
13091309
import struct
13101310

13111311

1312-
class LogRecordStreamHandler(socketserver.StreamRequestHandler):
1312+
class LogRecordStreamHandler(SocketServer.StreamRequestHandler):
13131313
"""Handler for a streaming logging request.
13141314

13151315
This basically logs the record using whatever logging policy is
@@ -1351,7 +1351,7 @@ module. Here is a basic working example::
13511351
# cycles and network bandwidth!
13521352
logger.handle(record)
13531353

1354-
class LogRecordSocketReceiver(socketserver.ThreadingTCPServer):
1354+
class LogRecordSocketReceiver(SocketServer.ThreadingTCPServer):
13551355
"""simple TCP socket-based logging receiver suitable for testing.
13561356
"""
13571357

@@ -1360,7 +1360,7 @@ module. Here is a basic working example::
13601360
def __init__(self, host='localhost',
13611361
port=logging.handlers.DEFAULT_TCP_LOGGING_PORT,
13621362
handler=LogRecordStreamHandler):
1363-
socketserver.ThreadingTCPServer.__init__(self, (host, port), handler)
1363+
SocketServer.ThreadingTCPServer.__init__(self, (host, port), handler)
13641364
self.abort = 0
13651365
self.timeout = 1
13661366
self.logname = None

Doc/library/repr.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
.. sectionauthor:: Fred L. Drake, Jr. <[email protected]>
88

99
.. note::
10-
The :mod:`repr` module has been renamed to :mod:`reprlib` in
11-
Python 3.0.
10+
The :mod:`repr` module has been renamed to :mod:`reprlib` in Python 3.0. The
11+
:term:`2to3` tool will automatically adapt imports when converting your
12+
sources to 3.0.
1213

1314
The :mod:`repr` module provides a means for producing object representations
1415
with limits on the size of the resulting strings. This is used in the Python

Doc/library/simplexmlrpcserver.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ XML-RPC servers written in Python. Servers can either be free standing, using
2222
functions that can be called by the XML-RPC protocol. The *requestHandler*
2323
parameter should be a factory for request handler instances; it defaults to
2424
:class:`SimpleXMLRPCRequestHandler`. The *addr* and *requestHandler* parameters
25-
are passed to the :class:`socketserver.TCPServer` constructor. If *logRequests*
25+
are passed to the :class:`SocketServer.TCPServer` constructor. If *logRequests*
2626
is true (the default), requests will be logged; setting this parameter to false
2727
will turn off logging. The *allow_none* and *encoding* parameters are passed
2828
on to :mod:`xmlrpclib` and control the XML-RPC responses that will be returned
@@ -63,7 +63,7 @@ SimpleXMLRPCServer Objects
6363
--------------------------
6464

6565
The :class:`SimpleXMLRPCServer` class is based on
66-
:class:`socketserver.TCPServer` and provides a means of creating simple, stand
66+
:class:`SocketServer.TCPServer` and provides a means of creating simple, stand
6767
alone XML-RPC servers.
6868

6969

Doc/library/socket.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ The module :mod:`socket` exports the following constants and functions:
481481

482482
.. seealso::
483483

484-
Module :mod:`socketserver`
484+
Module :mod:`SocketServer`
485485
Classes that simplify writing network servers.
486486

487487

Doc/library/socketserver.rst

+20-21
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
:mod:`socketserver` --- A framework for network servers
1+
2+
:mod:`SocketServer` --- A framework for network servers
23
=======================================================
34

45
.. module:: SocketServer
5-
:synopsis: Old name for the socketserver module.
6-
7-
.. module:: socketserver
86
:synopsis: A framework for network servers.
97

108
.. note::
11-
The :mod:`SocketServer` module has been renamed to :mod:`socketserver` in
12-
Python 3.0. It is importable under both names in Python 2.6 and the rest of
13-
the 2.x series.
9+
10+
The :mod:`SocketServer` module has been renamed to `socketserver` in Python
11+
3.0. The :term:`2to3` tool will automatically adapt imports when converting
12+
your sources to 3.0.
1413

1514

16-
The :mod:`socketserver` module simplifies the task of writing network servers.
15+
The :mod:`SocketServer` module simplifies the task of writing network servers.
1716

1817
There are four basic server classes: :class:`TCPServer` uses the Internet TCP
1918
protocol, which provides for continuous streams of data between the client and
@@ -220,7 +219,7 @@ server classes like :class:`TCPServer`; these methods aren't useful to external
220219
users of the server object.
221220

222221
.. XXX should the default implementations of these be documented, or should
223-
it be assumed that the user will look at socketserver.py?
222+
it be assumed that the user will look at SocketServer.py?
224223
225224
226225
.. function:: finish_request()
@@ -325,14 +324,14 @@ request.
325324
Examples
326325
--------
327326

328-
:class:`socketserver.TCPServer` Example
327+
:class:`SocketServer.TCPServer` Example
329328
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
330329

331330
This is the server side::
332331

333-
import socketserver
332+
import SocketServer
334333

335-
class MyTCPHandler(socketserver.BaseRequestHandler):
334+
class MyTCPHandler(SocketServer.BaseRequestHandler):
336335
"""
337336
The RequestHandler class for our server.
338337

@@ -353,7 +352,7 @@ This is the server side::
353352
HOST, PORT = "localhost", 9999
354353

355354
# Create the server, binding to localhost on port 9999
356-
server = socketserver.TCPServer((HOST, PORT), MyTCPHandler)
355+
server = SocketServer.TCPServer((HOST, PORT), MyTCPHandler)
357356

358357
# Activate the server; this will keep running until you
359358
# interrupt the program with Ctrl-C
@@ -362,7 +361,7 @@ This is the server side::
362361
An alternative request handler class that makes use of streams (file-like
363362
objects that simplify communication by providing the standard file interface)::
364363

365-
class MyTCPHandler(socketserver.StreamRequestHandler):
364+
class MyTCPHandler(SocketServer.StreamRequestHandler):
366365

367366
def handle(self):
368367
# self.rfile is a file-like object created by the handler;
@@ -423,14 +422,14 @@ Client::
423422
Received: PYTHON IS NICE
424423

425424

426-
:class:`socketserver.UDPServer` Example
425+
:class:`SocketServer.UDPServer` Example
427426
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
428427

429428
This is the server side::
430429

431-
import socketserver
430+
import SocketServer
432431

433-
class MyUDPHandler(socketserver.BaseRequestHandler):
432+
class MyUDPHandler(SocketServer.BaseRequestHandler):
434433
"""
435434
This class works similar to the TCP handler class, except that
436435
self.request consists of a pair of data and client socket, and since
@@ -447,7 +446,7 @@ This is the server side::
447446

448447
if __name__ == "__main__":
449448
HOST, PORT = "localhost", 9999
450-
server = socketserver.UDPServer((HOST, PORT), BaseUDPRequestHandler)
449+
server = SocketServer.UDPServer((HOST, PORT), BaseUDPRequestHandler)
451450
server.serve_forever()
452451

453452
This is the client side::
@@ -482,17 +481,17 @@ An example for the :class:`ThreadingMixIn` class::
482481

483482
import socket
484483
import threading
485-
import socketserver
484+
import SocketServer
486485

487-
class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
486+
class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
488487

489488
def handle(self):
490489
data = self.request.recv(1024)
491490
cur_thread = threading.currentThread()
492491
response = "%s: %s" % (cur_thread.getName(), data)
493492
self.request.send(response)
494493

495-
class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
494+
class ThreadedTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
496495
pass
497496

498497
def client(ip, port, message):

0 commit comments

Comments
 (0)