[Python-checkins] r82018 - python/trunk/Doc/library/simplehttpserver.rst
R. David Murray
rdmurray at bitdance.com
Wed Jun 16 19:15:51 CEST 2010
On Wed, 16 Jun 2010 16:55:31 +0200, senthil.kumaran <python-checkins at python.org> wrote:
> Author: senthil.kumaran
> Date: Wed Jun 16 16:55:31 2010
> New Revision: 82018
>
> Log:
> Fix Issue8937 - SimpleHTTPServer should contain usage example
>
>
> Modified:
> python/trunk/Doc/library/simplehttpserver.rst
>
> Modified: python/trunk/Doc/library/simplehttpserver.rst
> ==============================================================================
> --- python/trunk/Doc/library/simplehttpserver.rst (original)
> +++ python/trunk/Doc/library/simplehttpserver.rst Wed Jun 16 16:55:31 2010
> @@ -81,12 +81,34 @@
> contents of the file are output. If the file's MIME type starts with
> ``text/`` the file is opened in text mode; otherwise binary mode is used.
>
> - For example usage, see the implementation of the :func:`test` function.
> + The :func:`test` function in the :mod:`SimpleHTTPServer` module is an
> + example which interfaces the :class:`SimpleHTTPRequestHandler` as a
> + Handler to the :mod:`BaseHTTPServer` module.
I don't think this is correct English ("which interfaces the
SimpleHTTPRequestHandler as a Handler..."), because I'm not sure what the
meaning is. Do you mean something like "which creates a server using
the BaseHTTPServer module, using SimpleHTTPRequestHandler as a Handler"?
> .. versionadded:: 2.5
> The ``'Last-Modified'`` header.
>
>
> +The :mod:`SimpleHTTPServer` module can be used the following manner in order to
> +setup a very basic web server serving files relative to the current directory.::
setup should be two words in this context ("set up").
> +
> + import SimpleHTTPServer
> + import SocketServer
> +
> + PORT = 8000
> +
> + Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
> +
> + httpd = SocketServer.TCPServer(("", PORT), Handler)
> +
> + print "serving at port", PORT
> + httpd.serve_forever()
> +
> +It can also be invoked directly using the ``-m`` switch of interpreter a with
It is not clear what "It" is here. I think you mean "the SimpleHTTPServer
module", but as written it could equally well be the example code
above it. It also isn't clear (from these docs) what *happens* when
you execute the example line below. Does it serve files relative to
the current directly, like the preceding example?
> +``port number`` argument.::
> +
> + python -m SimpleHTTPServer 8000
> +
> .. seealso::
>
> Module :mod:`BaseHTTPServer`
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins
More information about the Python-checkins
mailing list