Issue 15608: Improve socketserver doc (original) (raw)

Created on 2012-08-09 19:44 by terry.reedy, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (7)

msg167825 - (view)

Author: Terry J. Reedy (terry.reedy) * (Python committer)

Date: 2012-08-09 19:44

On Windows, 3.3 socketserver defines 12 classes in 3 categories: servers, server mixins, and handlers. (At least, these are the one listed with dir(socketserver). Only BaseServer is indexed. I think all should be. There are also a couple of text issues.

BaseServer - indexed, doc is 20.19.2. Server Objects

TCPServer - mentioned in diagram and text of 20.19.1 UDPServer - ditto (I presume *nix version have unixxxx classes also)

ForkingMixIn - text of 20.19.1 ThreadingMixIn - ditto

ForkingTCPServer ForkingUDPServer ThreadingTCPServer ThreadingUDPServer

Text says "Forking and threading versions of each type of server can be created using the ForkingMixIn and ThreadingMixIn mix-in classes. For instance, a threading UDP server class is created as follows: class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass The mix-in class must come first, since it overrides a method defined in UDPServer."

"can be" means to me that user must create these. I am guessing that pre-defining them was added later. So text should change to 'have been'. The pre-created combinations should be listed. The last sentence could then say "Thhe mix-in class comes first since it overrides...".


BaseRequestHandler

This is documented in 20.19.2 RequestHandler Objects. But instead of starting with something like

class socketserver.BaseRequestHandler This is the superclass of all RequestHandler objects. It defines the interface, given below, but does not implement most of the methods, which is done in subclasses. A new instance of the subclass is created for each request.

analogous to the initial entry in 20.19.1, 20.19.2 starts with

"The request handler class must define a new handle() method, and can override any of the following methods. A new instance is created for each request.

I suggest that this be replaced with a standard class entry like the one above. If done, I resume the "RequestHandler" method prefix should be "BaseRequestHandler".

StreamRequestHandler - these two are described in a paragraph DatagramRequestHandler - after the handle method entry


In summary:

  1. index all classes to point to locations indicated above.
  2. state that mixin combinations are pre-defined.
  3. give BaseRequestHandler a proper entry.
  4. revise above as needed for *nix.
  5. optionally adjust as needed for 2.7.

msg167843 - (view)

Author: Terry J. Reedy (terry.reedy) * (Python committer)

Date: 2012-08-09 22:04

BaseRequestHandler.init(self, request) apparently attaches request to the instance as self.request.

The methods are called in this order: setup, handle, finish. If they must be confusingly documented in the opposite order, it would be good for the head entry to state the correct order.

msg234159 - (view)

Author: Martin Panter (martin.panter) * (Python committer)

Date: 2015-01-17 03:39

The post makes a bit more sense once you realize the dotted numbers refer to old section numbers (which have moved on now):

20.19.2 → “Server Objects” section 20.19.1 → “Server Creation Notes”

Regarding point 2: Instructions for the user to make a threading or forking are still relevant when using a subclass (e.g. HTTPServer) that does not come with a predefined subclass. However documenting which predefined classes exist would be nice too.

msg235142 - (view)

Author: Martin Panter (martin.panter) * (Python committer)

Date: 2015-02-01 04:38

Here is an attempt to tidy up the socketserver documentation:

  1. Added headings for each concrete class and mixin
  2. Listed the predefined mixin subclasses
  3. Changed RequestHandler to BaseRequestHandler and added class heading
  4. Included headings for UnixStream/DatagramServer

Other fixes:

msg235164 - (view)

Author: Martin Panter (martin.panter) * (Python committer)

Date: 2015-02-01 12:21

Main changes in socketserver-doc.2.patch:

msg260500 - (view)

Author: Roundup Robot (python-dev) (Python triager)

Date: 2016-02-19 03:35

New changeset 8b71cd67f548 by Martin Panter in branch '3.5': Issue #15608: Improve socketserver module documentation https://hg.python.org/cpython/rev/8b71cd67f548

New changeset fbb8b634fe59 by Martin Panter in branch 'default': Issue #15608: Merge socketserver doc from 3.5 https://hg.python.org/cpython/rev/fbb8b634fe59

msg260501 - (view)

Author: Roundup Robot (python-dev) (Python triager)

Date: 2016-02-19 04:01

New changeset 9211b7e60c92 by Martin Panter in branch '2.7': Issue #15608: Improve socketserver module documentation https://hg.python.org/cpython/rev/9211b7e60c92

History

Date

User

Action

Args

2022-04-11 14:57:34

admin

set

github: 59813

2016-02-19 04:04:09

martin.panter

set

status: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 2.7, Python 3.6, - Python 3.4

2016-02-19 04:01:38

python-dev

set

messages: +

2016-02-19 03:35:13

python-dev

set

nosy: + python-dev
messages: +

2015-02-01 12:21:52

martin.panter

set

files: + socketserver-doc.2.patch

messages: +

2015-02-01 05:02:24

berker.peksag

set

nosy: + berker.peksag
stage: patch review
type: enhancement

versions: + Python 3.4, Python 3.5, - Python 3.3

2015-02-01 04:38:22

martin.panter

set

files: + socketserver-doc.patch
keywords: + patch
messages: +

2015-01-17 03:39:19

martin.panter

set

nosy: + martin.panter
messages: +

2012-08-09 22:04:50

terry.reedy

set

messages: +

2012-08-09 19:44:26

terry.reedy

create