New submission from Terry J. Reedy: 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. ---------- assignee: docs@python components: Documentation messages: 167825 nosy: docs@python, terry.reedy priority: normal severity: normal status: open title: Improve socketserver doc versions: Python 3.3 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15608> _______________________________________
Terry J. Reedy added the comment: 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. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15608> _______________________________________
Martin Panter added the comment: 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. ---------- nosy: +vadmium _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15608> _______________________________________
Martin Panter added the comment: 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: * Fixed many class and method cross references * Pulled out Stream/DatagramRequestHandler definitions * Reordered the request handler setup(), handle(), finish() methods ---------- keywords: +patch Added file: http://bugs.python.org/file37950/socketserver-doc.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15608> _______________________________________
Changes by Berker Peksag <berker.peksag@gmail.com>: ---------- nosy: +berker.peksag stage: -> patch review type: -> enhancement versions: +Python 3.4, Python 3.5 -Python 3.3 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15608> _______________________________________
Martin Panter added the comment: Main changes in socketserver-doc.2.patch: * Documented constructor parameters for the server classes * Indented class methods and attributes underneath class headings ---------- Added file: http://bugs.python.org/file37957/socketserver-doc.2.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15608> _______________________________________
Roundup Robot added the comment: 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 ---------- nosy: +python-dev _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15608> _______________________________________
Roundup Robot added the comment: New changeset 9211b7e60c92 by Martin Panter in branch '2.7': Issue #15608: Improve socketserver module documentation https://hg.python.org/cpython/rev/9211b7e60c92 ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15608> _______________________________________
Changes by Martin Panter <vadmium+py@gmail.com>: ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 2.7, Python 3.6 -Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15608> _______________________________________
participants (4)
-
Berker Peksag
-
Martin Panter
-
Roundup Robot
-
Terry J. Reedy