]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
More autodoc fixes
authorBen Darnell <ben@bendarnell.com>
Fri, 10 Jun 2011 07:13:20 +0000 (00:13 -0700)
committerBen Darnell <ben@bendarnell.com>
Fri, 10 Jun 2011 07:13:20 +0000 (00:13 -0700)
14 files changed:
tornado/escape.py
tornado/httpclient.py
tornado/httpserver.py
tornado/ioloop.py
tornado/iostream.py
tornado/locale.py
tornado/template.py
website/sphinx/escape.rst
website/sphinx/httpclient.rst
website/sphinx/httpserver.rst
website/sphinx/ioloop.rst
website/sphinx/iostream.rst
website/sphinx/locale.rst
website/sphinx/template.rst

index 74a1caa7eb737d7068e370440a97c3bcd28c8478..3fa602be140f7f0e521eb32fc8aac451859b1e17 100644 (file)
@@ -211,11 +211,15 @@ def linkify(text, shorten=False, extra_params="",
     Hello <a href="http://tornadoweb.org">http://tornadoweb.org</a>!
 
     Parameters:
+
     shorten: Long urls will be shortened for display.
+
     extra_params: Extra text to include in the link tag,
         e.g. linkify(text, extra_params='rel="nofollow" class="external"')
+
     require_protocol: Only linkify urls which include a protocol. If this is
         False, urls such as www.facebook.com will also be linkified.
+
     permitted_protocols: List (or set) of protocols which should be linkified,
         e.g. linkify(text, permitted_protocols=["http", "ftp", "mailto"]).
         It is very unsafe to include protocols such as "javascript".
index 781ce6e3b097f10a4be6631ff62ae6c91d50810e..0b77c480dd7e2d8f695c35e37c7d3a8f7e9eff70 100644 (file)
@@ -13,7 +13,7 @@ from tornado.util import import_object, bytes_type
 class HTTPClient(object):
     """A blocking HTTP client.
 
-    Typical usage looks like this:
+    Typical usage looks like this::
 
         http_client = httpclient.HTTPClient()
         try:
@@ -51,7 +51,7 @@ class HTTPClient(object):
 class AsyncHTTPClient(object):
     """An non-blocking HTTP client.
 
-    Example usage:
+    Example usage::
 
         import ioloop
 
@@ -208,13 +208,21 @@ class HTTPResponse(object):
     """HTTP Response object.
 
     Attributes:
+
     * request: HTTPRequest object
+
     * code: numeric HTTP status code, e.g. 200 or 404
+
     * headers: httputil.HTTPHeaders object
+
     * buffer: cStringIO object for response body
+
     * body: respose body as string (created on demand from self.buffer)
+
     * error: Exception object, if any
+
     * request_time: seconds from request start to finish
+
     * time_info: dictionary of diagnostic timing information from the request.
         Available data are subject to change, but currently uses timings
         available from http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html,
@@ -266,8 +274,10 @@ class HTTPError(Exception):
     """Exception thrown for an unsuccessful HTTP request.
 
     Attributes:
+
     code - HTTP error integer error code, e.g. 404.  Error code 599 is
            used when no HTTP response was received, e.g. for a timeout.
+
     response - HTTPResponse object, if any.
 
     Note that if follow_redirects is False, redirects become HTTPErrors,
index 04a7157b8553d2e8a873d08d16f89c5120d92df7..cbecfce19e5a852db4b98a7e0f83a3ee5c382ef9 100644 (file)
@@ -64,14 +64,14 @@ def _cpu_count():
 
 
 class HTTPServer(object):
-    """A non-blocking, single-threaded HTTP server.
+    r"""A non-blocking, single-threaded HTTP server.
 
     A server is defined by a request callback that takes an HTTPRequest
     instance as an argument and writes a valid HTTP response with
     request.write(). request.finish() finishes the request (but does not
     necessarily close the connection in the case of HTTP/1.1 keep-alive
     requests). A simple example server that echoes back the URI you
-    requested:
+    requested::
 
         import httpserver
         import ioloop
@@ -105,7 +105,7 @@ class HTTPServer(object):
     HTTPServer can serve HTTPS (SSL) traffic with Python 2.6+ and OpenSSL.
     To make this server serve SSL traffic, send the ssl_options dictionary
     argument with the arguments required for the ssl.wrap_socket() method,
-    including "certfile" and "keyfile":
+    including "certfile" and "keyfile"::
 
        HTTPServer(applicaton, ssl_options={
            "certfile": os.path.join(data_dir, "mydomain.crt"),
@@ -114,7 +114,7 @@ class HTTPServer(object):
 
     By default, listen() runs in a single thread in a single process. You
     can utilize all available CPUs on this machine by calling bind() and
-    start() instead of listen():
+    start() instead of listen()::
 
         http_server = httpserver.HTTPServer(handle_request)
         http_server.bind(8888)
@@ -503,7 +503,8 @@ class HTTPRequest(object):
         """Returns the client's SSL certificate, if any.
 
         To use client certificates, the HTTPServer must have been constructed
-        with cert_reqs set in ssl_options, e.g.:
+        with cert_reqs set in ssl_options, e.g.::
+
             server = HTTPServer(app,
                 ssl_options=dict(
                     certfile="foo.crt",
index 4eef01afa76c505bde3a9a0512a7c8ead318dcc9..0e0892a83ceaa5a9f650fd56c994355893bc91a7 100644 (file)
@@ -49,7 +49,7 @@ class IOLoop(object):
     connections, you should use Linux and either compile our epoll module or
     use Python 2.6+ to get epoll support.
 
-    Example usage for a simple TCP server:
+    Example usage for a simple TCP server::
 
         import errno
         import functools
@@ -132,7 +132,7 @@ class IOLoop(object):
 
         A common pattern for classes that depend on IOLoops is to use
         a default argument to enable programs with multiple IOLoops
-        but not require the argument for simpler applications:
+        but not require the argument for simpler applications::
 
             class MyClass(object):
                 def __init__(self, io_loop=None):
@@ -296,10 +296,12 @@ class IOLoop(object):
         will return immediately.
 
         To use asynchronous methods from otherwise-synchronous code (such as
-        unit tests), you can start and stop the event loop like this:
+        unit tests), you can start and stop the event loop like this::
+
           ioloop = IOLoop()
           async_method(ioloop=ioloop, callback=ioloop.stop)
           ioloop.start()
+
         ioloop.start() will return after async_method has run its callback,
         whether that callback was invoked before or after ioloop.start.
         """
index 4b005f62ce45d2d3e32b9a09321fdaa0bb3fa9d9..d9c8b7dcb8ffb112cb093539512841c2509edab9 100644 (file)
@@ -34,7 +34,7 @@ except ImportError:
     ssl = None
 
 class IOStream(object):
-    """A utility class to write to and read from a non-blocking socket.
+    r"""A utility class to write to and read from a non-blocking socket.
 
     We support three methods: write(), read_until(), and read_bytes().
     All of the methods take callbacks (since writing and reading are
@@ -48,7 +48,7 @@ class IOStream(object):
     and may either be connected before passing it to the IOStream or
     connected with IOStream.connect.
 
-    A very simple (and broken) HTTP client using this class:
+    A very simple (and broken) HTTP client using this class::
 
         from tornado import ioloop
         from tornado import iostream
index b16a9000697ac10bac7e4fbc3a05bdcdca721e84..f4b0b630ab9249fb01e2ba63e862a9eee3abe367 100644 (file)
 
 """Translation methods for generating localized strings.
 
-To load a locale and generate a translated string:
+To load a locale and generate a translated string::
 
     user_locale = locale.get("es_LA")
     print user_locale.translate("Sign out")
 
 locale.get() returns the closest matching locale, not necessarily the
 specific locale you requested. You can support pluralization with
-additional arguments to translate(), e.g.:
+additional arguments to translate(), e.g.::
 
     people = [...]
     message = user_locale.translate(
index 648621ed05c965ce9f07591a96075f7367034768..44814bd78a8dd68e2fdd9c64657294b223adf230 100644 (file)
 
 """A simple template system that compiles templates to Python code.
 
-Basic usage looks like:
+Basic usage looks like::
 
     t = template.Template("<html>{{ myvalue }}</html>")
     print t.generate(myvalue="XXX")
 
 Loader is a class that loads templates from a root directory and caches
-the compiled templates:
+the compiled templates::
 
     loader = template.Loader("/home/btaylor")
     print loader.load("test.html").generate(myvalue="XXX")
 
 We compile all templates to raw Python. Error-reporting is currently... uh,
-interesting. Syntax for the templates
+interesting. Syntax for the templates::
 
     ### base.html
     <html>
@@ -57,7 +57,7 @@ interesting. Syntax for the templates
 
 Unlike most other template systems, we do not put any restrictions on the
 expressions you can include in your statements. if and for blocks get
-translated exactly into Python, do you can do complex expressions like:
+translated exactly into Python, do you can do complex expressions like::
 
    {% for student in [p for p in people if p.student and p.age > 23] %}
      <li>{{ escape(student.name) }}</li>
@@ -65,7 +65,7 @@ translated exactly into Python, do you can do complex expressions like:
 
 Translating directly to Python means you can apply functions to expressions
 easily, like the escape() function in the examples above. You can pass
-functions in to your template just like any other variable:
+functions in to your template just like any other variable::
 
    ### Python code
    def add(x, y):
index 0c35cf05e38e4da45cc7ce885a8efd6b69aa2d18..d67ec5898d30ae6b1e3438636940e726521f85de 100644 (file)
@@ -2,3 +2,4 @@
 ======================
 
 .. automodule:: tornado.escape
+   :members:
index 14eb643ff6b03a8195b67092b5d451e7c8235c14..4022a63f83d83ee10f5f3ce31417e8b2a61e1e0e 100644 (file)
@@ -2,3 +2,4 @@
 ======================
 
 .. automodule:: tornado.httpclient
+   :members:
index 85c2b1a07ab92069a4d860c4610faf54e5c23bbe..11e5c3efbc29df2a4aea48c509f74c3b606356fd 100644 (file)
@@ -2,3 +2,4 @@
 ======================
 
 .. automodule:: tornado.httpserver
+   :members:
index 2cf69d98af241ea1194a9d46024d3744f0f7740d..03f9072c08937f1be79860935d8284fa6d9b67a6 100644 (file)
@@ -2,3 +2,4 @@
 ======================
 
 .. automodule:: tornado.ioloop
+   :members:
index e43671a32438c5fa06de6b36989573ecdf2fa400..e65ca27eccdbb7498cc1e51b18ea7465f6263e43 100644 (file)
@@ -2,3 +2,4 @@
 ======================
 
 .. automodule:: tornado.iostream
+   :members:
index cb7ce77cb9d7a4971b0a740e6b22103d6fb9df1e..41b8bf274569491de44afed51e70750835347049 100644 (file)
@@ -2,3 +2,4 @@
 ======================
 
 .. automodule:: tornado.locale
+   :members:
index 34a8a4b058b45e0c8ca572e77c20f8ff12e367d9..d9d549403d3e2f0c044d4f4324a85785b6cebf20 100644 (file)
@@ -2,3 +2,4 @@
 ======================
 
 .. automodule:: tornado.template
+   :members: