diff options
| author | Benjamin Peterson <benjamin@python.org> | 2008-04-25 01:29:10 (GMT) |
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2008-04-25 01:29:10 (GMT) |
| commit | c7b05920d6536f7edba098d5018a470d35f2e864 (patch) | |
| tree | ce0f68baf5c7794f235604c64cde02c12aeed3de /Doc/library/simplehttpserver.rst | |
| parent | 1c596d5604e4fc79944281ddc5baa666f6e27e85 (diff) | |
| download | cpython-c7b05920d6536f7edba098d5018a470d35f2e864.zip cpython-c7b05920d6536f7edba098d5018a470d35f2e864.tar.gz cpython-c7b05920d6536f7edba098d5018a470d35f2e864.tar.bz2 | |
reformat some documentation of classes so methods and attributes are under the class directive
Diffstat (limited to 'Doc/library/simplehttpserver.rst')
| -rw-r--r-- | Doc/library/simplehttpserver.rst | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/Doc/library/simplehttpserver.rst b/Doc/library/simplehttpserver.rst index 766253e..8d04e3f 100644 --- a/Doc/library/simplehttpserver.rst +++ b/Doc/library/simplehttpserver.rst @@ -23,60 +23,62 @@ The :mod:`SimpleHTTPServer` module defines the following class: :class:`BaseHTTPServer.BaseHTTPRequestHandler`. This class implements the :func:`do_GET` and :func:`do_HEAD` functions. -The :class:`SimpleHTTPRequestHandler` defines the following member variables: + The :class:`SimpleHTTPRequestHandler` defines the following member variables: -.. attribute:: SimpleHTTPRequestHandler.server_version + .. attribute:: server_version - This will be ``"SimpleHTTP/" + __version__``, where ``__version__`` is defined - in the module. + This will be ``"SimpleHTTP/" + __version__``, where ``__version__`` is + defined in the module. -.. attribute:: SimpleHTTPRequestHandler.extensions_map + .. attribute:: extensions_map - A dictionary mapping suffixes into MIME types. The default is signified by an - empty string, and is considered to be ``application/octet-stream``. The mapping - is used case-insensitively, and so should contain only lower-cased keys. + A dictionary mapping suffixes into MIME types. The default is signified by + an empty string, and is considered to be ``application/octet-stream``. The + mapping is used case-insensitively, and so should contain only lower-cased + keys. -The :class:`SimpleHTTPRequestHandler` defines the following methods: + The :class:`SimpleHTTPRequestHandler` defines the following methods: -.. method:: SimpleHTTPRequestHandler.do_HEAD() + .. method:: do_HEAD() - This method serves the ``'HEAD'`` request type: it sends the headers it would - send for the equivalent ``GET`` request. See the :meth:`do_GET` method for a - more complete explanation of the possible headers. + This method serves the ``'HEAD'`` request type: it sends the headers it + would send for the equivalent ``GET`` request. See the :meth:`do_GET` + method for a more complete explanation of the possible headers. -.. method:: SimpleHTTPRequestHandler.do_GET() + .. method:: do_GET() - The request is mapped to a local file by interpreting the request as a path - relative to the current working directory. + The request is mapped to a local file by interpreting the request as a + path relative to the current working directory. - If the request was mapped to a directory, the directory is checked for a file - named ``index.html`` or ``index.htm`` (in that order). If found, the file's - contents are returned; otherwise a directory listing is generated by calling the - :meth:`list_directory` method. This method uses :func:`os.listdir` to scan the - directory, and returns a ``404`` error response if the :func:`listdir` fails. + If the request was mapped to a directory, the directory is checked for a + file named ``index.html`` or ``index.htm`` (in that order). If found, the + file's contents are returned; otherwise a directory listing is generated + by calling the :meth:`list_directory` method. This method uses + :func:`os.listdir` to scan the directory, and returns a ``404`` error + response if the :func:`listdir` fails. - If the request was mapped to a file, it is opened and the contents are returned. - Any :exc:`IOError` exception in opening the requested file is mapped to a - ``404``, ``'File not found'`` error. Otherwise, the content type is guessed by - calling the :meth:`guess_type` method, which in turn uses the *extensions_map* - variable. + If the request was mapped to a file, it is opened and the contents are + returned. Any :exc:`IOError` exception in opening the requested file is + mapped to a ``404``, ``'File not found'`` error. Otherwise, the content + type is guessed by calling the :meth:`guess_type` method, which in turn + uses the *extensions_map* variable. - A ``'Content-type:'`` header with the guessed content type is output, followed - by a ``'Content-Length:'`` header with the file's size and a - ``'Last-Modified:'`` header with the file's modification time. + A ``'Content-type:'`` header with the guessed content type is output, + followed by a ``'Content-Length:'`` header with the file's size and a + ``'Last-Modified:'`` header with the file's modification time. - Then follows a blank line signifying the end of the headers, and then the - 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. + Then follows a blank line signifying the end of the headers, and then the + 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. + For example usage, see the implementation of the :func:`test` function. - .. versionadded:: 2.5 - The ``'Last-Modified'`` header. + .. versionadded:: 2.5 + The ``'Last-Modified'`` header. .. seealso:: |
