Package twisted :: Package flow :: Module web :: Class Resource

[frames | no frames]

## Class Resource

    Resource --+
               |
              Resource

    a resource which uses flow in its page generation

    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()

Method Summary
| `__init__(self, gen)`
| `render(self, req)`
Inherited from Resource
| ``delEntity`(self, name)`
| ``getChild`(self, path, request)` Retrieve a 'child' resource from me.
| ``getChildForRequest`(self, request)`
| ``getChildWithDefault`(self, path, request)` Retrieve a static or dynamically generated child resource from me.
| ``getDynamicEntity`(self, name, request)`
| ``getStaticEntity`(self, name)`
| `isLeaf(self)`
| ``listDynamicEntities`(self, request)`
| ``listDynamicNames`(self)`
| ``listEntities`(self)`
| ``listNames`(self)`
| ``listStaticEntities`(self)`
| ``listStaticNames`(self)`
| ``putChild`(self, path, child)` Register a static child.
| ``reallyPutEntity`(self, name, entity)`
| ``render_HEAD`(self, request)` Default handling of HEAD method.

Class Variable Summary
Inherited from Resource
`tuple` | `__implements__` = `(<class twisted.web.resource.IResource ...`
`int` | `isLeaf` = 0
`NoneType` | `server` = None

Generated by Epydoc 2.0 on Sat May 15 20:08:20 2004 | http://epydoc.sf.net