[Twisted-Python] Quixote/Twisted Integration

Moshe Zadka twisted at moshez.org
Mon Oct 7 07:25:44 MDT 2002


Hi!

I've added a feature to the Twisted web server where it can use Quixote's
PTL. Here's a (completely overkill) example:

-------------- hello.rtl ---------------
from twisted.web.resource import Resource


class ExampleResource(Resource):

    template render(self, request):
        """\
<HTML>
    <HEAD><TITLE> Welcome To Twisted Python </title></head>

    <BODY>
    This is a demonstration of embedded template python in a webserver.
    </body>
</html>"""


resource = ExampleResource()
------------------------------------------

Then configure the web server with:

% ./bin/mktap web --path=`pwd` --processor=.rtl=twisted.web.script.ResourceTemplate --port=10999
% ./bin/twistd -f web.tap

And then http://localhost:10999/hello.rtl will show the expected output.

This uses some features only available from the Twisted CVS and was tested
with Quixote 0.5

Thanks.





More information about the Twisted-Python mailing list