Thanks David - it's now working! One minor error I get when I add a super call as: class ServerProtocol(http.HTTPChannel): def connectionMade(self): print "[connectionMade] entering function....." super(ServerProtocol, self).connectionMade() this generates: File "test.py", line 20, in connectionMade super(ServerProtocol, self).connectionMade() exceptions.TypeError: super() argument 1 must be type, not classobj Any ideas? Cheers Steve
From: David Reid
Reply-To: Twisted Web World To: Twisted Web World Subject: Re: [Twisted-web] Setting server.Site.protocol stops the site factoryresource class from renderin Date: Thu, 1 Mar 2007 07:10:51 -0800 -----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
_________________________________________________________________ Discover fun and games at @ http://xtramsn.co.nz/kids