[Twisted-web] Splitting twisted-web from core twisted.

David Reid dreid at dreid.org
Thu Apr 15 04:47:43 MDT 2004

Goals of a split:

* Simplify the twisted.web, don't make it do anything clever. 
	The clever stuff should be left up to nevow and perhaps kept a seperate
module.  Also given fzZzy's history it seems very likely that eventually
he will come up with something even better than Nevow, and it would just
be a waste to have to rewrite twisted.web (again) to support it. ;)

* Implement things like distrib and vhosts at a lower level.  
	Currently distrib and vhosts need to be reimplemented or atleast
violently shoehorned into working with Nevow.  This will likely be the
same with any future alternatives to Nevow.  I'll get into specifics
about distrib and vhosts later.

* Use new APIs.
	This is as good a chance as any to get rid of all those
DeprecationWarnings we get when starting a twisted.web server.

Concerns of a split:

* Failing.  
	I don't want to fork the code, I want to officially split twisted.web
from core twisted and refactor it to support the above goals.  I need to
know this is what people want to happen, and I need input to make sure
it's done Reasonably Right (TM)

Not Concerns of a split:

* Backwards compatibility.
	I'm ok with breaking old applications built on twisted.web.
I hope by simplifying the core we can expand the possibilities for later
development.  I've changed my mind about turning Nevow into
twisted.web2.  I think that would just cause more problems down the
line.  I want to make twisted.web the simplest webserver it can be
without sucking.

Distrib and Vhost Specifics:

Currently distrib really gets caught up handling some of the complex
objects that are used in the nevow.appserver.NevowRequest object.

It first throws an InsecureJelly exception when it hits a
nevow.context.WovenContext.  If you shoehorn that by making it a
pb.Copyable with a None returning getStateForCopy method it immediately
throws an exception for nevow.appserver.OldResourceAdapter.  When you
shoehorn that through with the above method it throws an InsecureJelly
exception when it hits twisted.internet.defer.Deferred.  Obviously you
can see why i wouldn't want to pursue that methodology futher.  It seems
silly to have to do that just so stuff won't go over ther wire, I'm sure
there is a simpler way but no one bothered to point it out to me when i
was asking about it.  

And NevowRequest seems like an ideal example of an object to complicated
to bother with passing it through pb.  Passing http.Request would be so
much simpler and it would get us a little bit closer to realize this
comment from twisted/web/distrib.py:

This is going to have to be refactored so that argument parsing is done
by each subprocess and not by the main web server (i.e. GET, POST etc.).

As I'm sure you've probably realized, I'm "That Guy Who Made Vhosts work
in Nevow".

Yes that is me.  And VHost wasn't such a big problem, but it got me
thinking about how to do distrib and that led me to realize that perhaps
they should not be implemented at what we currently think of as the
Resource level, but instead at the Site level or even before that.

Both technologies need a minimal ammount of information to process the
request.  So it seems silly to have them handle server.Request and
especially NevowRequest.

I guess I've sort of gone off on a rant there, and really wanted to
avoid that.  So I'll leave that as my opinion, and let you fine
programmers comment.   

The End.

These are just my first impressions about how a split should take place,
I will admit to not being up on the core twisted.web code and certainly
not on the core twisted.  But i'm willing to put in the effort to learn
it and take care of this if no one else is.  Right now i make $6.75US/hr
and go to school 2 days a week, i have probably as much free time as
anyone else and I really really want this stuff to work.

-- David Reid

More information about the Twisted-web mailing list