Part of twisted.flow.web View Source View In Hierarchy
A resource which uses flow in its page generation.
Use it like this:
from __future__ import generators
from twisted.flow import flow
def render(req):
req.write("<html><head><title>Delayed</title></head>")
req.write("<body><h1>Delayed WebPage</h1>")
yield flow.Cooperate(5)
req.write("<p>Delayed Content</p></body></html>")
if __name__=='__main__':
from twisted.internet import reactor
from twisted.web.server import Site
from twisted.flow.web import Resource
print "visit http://localhost:8081/ to view"
reactor.listenTCP(8081,Site(Resource(render)))
reactor.run()
Split Table into Classes Show Methods in One Table
| Line # | Kind | Name | Docs |
|---|---|---|---|
| 39 | Method | __init__ | Initialize. |
| 43 | Method | isLeaf | Signal if this IResource implementor is a "leaf node" or not. If True, |
| 46 | Method | render | Render a given resource. See IResource's
render method.
|
Inherited from Resource:
| Line # | Kind | Name | Docs |
|---|---|---|---|
| 74 | Method | listStaticNames | Undocumented |
| 77 | Method | listStaticEntities | Undocumented |
| 80 | Method | listNames | Undocumented |
| 83 | Method | listEntities | Undocumented |
| 86 | Method | listDynamicNames | Undocumented |
| 89 | Method | listDynamicEntities | Undocumented |
| 92 | Method | getStaticEntity | Undocumented |
| 95 | Method | getDynamicEntity | Undocumented |
| 101 | Method | delEntity | Undocumented |
| 104 | Method | reallyPutEntity | Undocumented |
| 109 | Method | getChild | Retrieve a 'child' resource from me. |
| 137 | Method | getChildWithDefault | Retrieve a static or dynamically generated child resource from me. |
| 153 | Method | getChildForRequest | Undocumented |
| 158 | Method | putChild | Register a static child. |
| 192 | Method | render_HEAD | Default handling of HEAD method. |
| Line # | Kind | Name | Docs |
|---|---|---|---|
| 39 | Method | __init__ | Initialize. |
| 101 | Method | delEntity | Undocumented |
| 109 | Method | getChild | Retrieve a 'child' resource from me. |
| 153 | Method | getChildForRequest | Undocumented |
| 137 | Method | getChildWithDefault | Retrieve a static or dynamically generated child resource from me. |
| 95 | Method | getDynamicEntity | Undocumented |
| 92 | Method | getStaticEntity | Undocumented |
| 43 | Method | isLeaf | Signal if this IResource implementor is a "leaf node" or not. If True, |
| 89 | Method | listDynamicEntities | Undocumented |
| 86 | Method | listDynamicNames | Undocumented |
| 83 | Method | listEntities | Undocumented |
| 80 | Method | listNames | Undocumented |
| 77 | Method | listStaticEntities | Undocumented |
| 74 | Method | listStaticNames | Undocumented |
| 158 | Method | putChild | Register a static child. |
| 104 | Method | reallyPutEntity | Undocumented |
| 46 | Method | render | Render a given resource. See IResource's
render method.
|
| 192 | Method | render_HEAD | Default handling of HEAD method. |
Render a given resource. See IResource's
render method.
I delegate to methods of self with the form 'render_METHOD' where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.
render_METHOD methods are expected to return a string which will be the rendered page, unless the return value is twisted.web.server.NOT_DONE_YET, in which case it is this class's responsibility to write the results to request.write(data), then call request.finish().
Old code that overrides render() directly is likewise expected to return a string or NOT_DONE_YET.