[Twisted-web] Nevow without twisted

Donovan Preston dp at ulaluma.com
Thu Jun 3 10:35:50 MDT 2004


On Jun 3, 2004, at 9:40 AM, Joe Bowers wrote:

> There has been some talk (although
> I may have imagined it, not being
> very IRC savvy) of making
> Nevow deployable outside of twisted
> (for example, as CGI). This sounds
> pretty hard! Is there really a development
> effort in this direction? Is it active?
> If so, is there a branch to contribute
> on, or a To Do list?

Most of the hard work is already done; however the hard work that is 
left is details, details, details. The remaining difficulty is going to 
be purging twisted-web assumptions from nevow.rend.Page.

If you are interested: The core nevow rendering refactor that happened 
between 0.1 and 0.2 has split the rendering machinery into two 
functions. nevow.flat.ten.iterflatten is the core render loop; it runs 
as a generator and has a yield hook which users of flatten can 
implement to pause and restart rendering if required. 
nevow.rend.deferflatten (which should be moved out of the rend module 
and into the flat package) is the code which drives iterflatten, 
pausing each time a deferred is encountered and waiting for the 
deferred to fire.

Right now rend.Page.renderHTTP just uses deferflatten directly, but it 
should be changed to import a new, undecided name from nevow.flat which 
is either a function that returns a string in the absence of Twisted 
(nevow.flat.ten.flatten), or a deferred in the presence of Twisted 
(what is currently nevow.rend.deferflatten).

Once this change is made to rend.Page and other needless twisted 
dependencies are purged from nevow.rend, the next step is to write a 
replacement for NevowSite.

NevowSite is a subclass of twisted.web.server.Site which is responsible 
for constructing a Request object and dispatching it to the appropriate 
Page which will fulfill the request. In the case of a CGI-specific 
replacement for NevowSite, an object which emulates IRequest (which is 
currently poorly defined) will need to be constructed which does the 
appropriate thing for CGI in the face of the various request methods 
(setHeader, setCookie, write, finish)

At the moment, all this required development I described is not 
happening. I don't have a burning need to be able to use Nevow without 
twisted.web. I would like it to be completed at some point, because I 
think using software in a variety of environments exposes inappropriate 
assumptions and I would like to make it as easy as possible to deploy 
very small Nevow applications quickly, for small apps and 
experimentation.

dp




More information about the Twisted-web mailing list