Utilizzare il framework Twisted.web2

from twisted.web2 import resource, http, http_headers, responsecode
from twisted.web2 import channel, server


class Pippo(resource.Resource):

        addSlash=True

        def render(self, req):
                return http.Response(responsecode.OK, {'content-type': http_headers.MimeType('text', 'html')}, 'sono pippo' )

class MyApp(resource.Resource):

        addSlash=True

        def render(self, req):
                return http.Response( responsecode.OK, {'content-type': http_headers.MimeType('text', 'html')}, req.uri )


        child_pippo = Pippo()

myapp = MyApp()

channel.startCGI(server.Site(myapp))

Twisted.web2 (l'ultima modifica รจ del 2007-04-19 08:19:40, fatta da RobertoDeIoris)