[Twisted-web] Setting server.Site.protocol stops the site factory resource class from renderin

David Reid dreid at dreid.org
Thu Mar 1 09:10:51 CST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Feb 28, 2007, at 7:52 PM, Steve doh wrote:

> I have the code below that works fine. If I uncomment the 3rd to  
> last line so that the site.protocol uses the ServerProtocol class,  
> then the render_GET() method does not get called and the browser  
> waits for a response. I understand why this is happening but don't  
> know how to fix it. I need to override the connectionMade() method  
> for the site factory inorder to verify the connection. Can someone  
> explain how I override connectionMade() correctly? Any help  
> appreciated. Cheers Steve

twisted.internet.protocol.Protocol doesn't know anything about HTTP,  
and it doesn't know anything about the resource hierarchy and HTTP  
methods.  server.Site.protocol defaults to  
twisted.web.http.HTTPChannel, which does know what to do when faced  
with HTTP, so subclass that instead.  And don't forget to call the  
superclass's connectionMade or timeouts won't work properly.

- -David
http://dreid.org

"Usually the protocol is this: I appoint someone for a task,
which they are not qualified to do.  Then, they have to fight
a bear if they don't want to do it." -- Glyph Lefkowitz




-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFF5u0CrsrO6aeULcgRAsQtAJwLjqQuv4AkoapqWKO/0ap/N/YGKgCfZz1o
KvS9cz9xZdGaxUW96buX+b8=
=Zlqp
-----END PGP SIGNATURE-----



More information about the Twisted-web mailing list