[Twisted-web] http.HTTPFactory(site) equivalent in web2.0.2?

David Reid dreid at dreid.org
Mon Jun 26 16:28:41 CDT 2006


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

Lenny G Arbage wrote:
> I previously used the following code with TwistedWeb2
> 0.1:
> 
>     site = server.Site(Toplevel())
>     reactor.listenTCP(1080, http.HTTPFactory(site))
>     reactor.run()
> 
> This no longer works in 2.0.2.  If I replace
> http.HTTPFactory with channel.HTTPFactory or
> channel.http.HTTPFactory, I don't get errors, but I
> get "405 Method Not Allowed" for any URL Resource I
> try to visit.
> 
> What is the proper way to do the above in 2.0.2?

channel.HTTPFactory(server.Site(rootresource)) is the proper way, and
I've just verified that it works on web2 0.2 (it's not 2.0.2.)  Without
seeing the implementation of TopLevel I don't have a clue what the
problem might be, except for some error on your part.

- -David

- --
"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.3 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEoFGJrsrO6aeULcgRAgrCAJ4nAIw29r7vYSNNz8pjlLVST7804ACeIXAO
TeTjw59qbKrjtyDd9iKcxzU=
=QCDk
-----END PGP SIGNATURE-----



More information about the Twisted-web mailing list