| 1 |
# Copyright (c) Twisted Matrix Laboratories. |
| 2 |
# See LICENSE for details. |
| 3 |
|
| 4 |
""" |
| 5 |
This example demostrates how to render a page using a third-party template |
| 6 |
system. |
| 7 |
|
| 8 |
Usage: |
| 9 |
$ twistd -n web --path /path/to/examples --process=.rtl=twisted.web.script.ResourceTemplate |
| 10 |
|
| 11 |
And make sure Quixote is installed. |
| 12 |
""" |
| 13 |
|
| 14 |
from twisted.web.resource import Resource |
| 15 |
|
| 16 |
|
| 17 |
class ExampleResource(Resource): |
| 18 |
|
| 19 |
def render_GET(self, request): |
| 20 |
output = """\ |
| 21 |
<HTML> |
| 22 |
<HEAD><TITLE> Welcome To Twisted Python </title></head> |
| 23 |
|
| 24 |
<BODY><ul>""" |
| 25 |
for i in range(10): |
| 26 |
'<LI>';i |
| 27 |
"""</ul></body> |
| 28 |
</html>""" |
| 29 |
return output.encode("utf8") |
| 30 |
|
| 31 |
|
| 32 |
resource = ExampleResource() |
| 33 |
|