[Twisted-web] Web2 Script.py seems to be broken

David Reid dreid at dreid.org
Wed Feb 8 09:29:07 MST 2006

Matt Goodall wrote:
> Todd Thomas wrote:
>>On 2/7/06, *James Y Knight* <foom at fuhm.net <mailto:foom at fuhm.net>> wrote:
>>    On Feb 7, 2006, at 4:09 AM, Todd Thomas wrote:
>>    > I find them extemely handy personally, how else are you going add
>>    > resources without resorting to restarting the server? But I guess
>>    > depends on what you are using them for. I tend to use twisted more
>>    > for testing and experimenting, simpler than installing apache.
>>    > Unfortunately twisted-web doesnt have a wsgi implementation, I have
>>    > been messing around with django a bit trying to see how modular the
>>    > code is.
>>    You'll notice that I said I was open to them still being supported.
>>    I'll take a submission of code + unit tests for it, or if not, will
>>    get around to implementing it someday.
>>    I'll also note, it should be possible to use twisted.web.script from
>>    within a twisted.web2 server, although you won't be able to use web2
>>    Resources in the rpys loaded by the twisted.web.script loader. (The
>>    compatibility only works one way -- you can use old resources inside
>>    new ones, but not new ones inside old ones).
>>    I think you might have meant this but it wasn't entirely clear so
>>    I'll also note that twisted.web2 does support wsgi.
>>    James
>>    _______________________________________________
>>    Twisted-web mailing list
>>    Twisted-web at twistedmatrix.com <mailto:Twisted-web at twistedmatrix.com>
>>    http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
>>    <http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web>
>>It does support wsgi, I was playing around with it. I went back to
>>twisted-web, I like its lower level approach. Using http.request
>>directly vs. resources is nice since I can pretty much tell exactly what
>>is going on. I love the fact that you can work at an extremely low level
>>in twisted-web. I hope twisted-web2 doesn't get too high level.

> I doubt it's difficult to write a server.Site equivalent to plug an
> alternative framework directly into web2's HTTP protocol support. IIRC,
> HTTPFactory expects nothing more than something callable that takes a
> bunch of args.

Please don't do this.

> Also, a root Resource that calls out to an alternative framework should
> be trivial to implement. See t.web2.iweb.IResource for details. You
> don't even need to subclass resource.Resource.

Please do this.  If you're going to write another web framework on top
of twisted.web2 you should atleast be able to deploy it along side
normal twisted.web2 resources or resources from another such framework.
locateChild makes this very easy, because you can consume an arbitrary
number of path segments at any point. (I know you know this Matt but you
made the suggestion so you get the reply ;))


More information about the Twisted-web mailing list