[Twisted-web] Set request headers in rend.Page

Donovan Preston dp at ulaluma.com
Mon May 31 18:58:39 MDT 2004

On May 31, 2004, at 8:50 PM, Mary Gardiner wrote:

> Is there some point where I can add new headers to the request in a 
> Page
> itself? I haven't tested thoroughly, but it seems to me that the HTTP
> headers have already been transmitted by the time render_ and data_
> methods are called.

Override beforeRender on your Page subclass, or just override 
renderHTTP directly. beforeRender is a hook for doing exactly these 
types of things.

Nevow streams html to the browser as the page is being rendered, so by 
the time your render_ method is called, all of the html which logically 
comes before that has been sent. Thus the headers have already been 

There was also previously a way to indicate that nevow should wait for 
the entire page render to complete before sending any data, which I may 
have inadvertently removed in a recent refactor. If it's important to 
anyone, let me know and I'll look into it.


More information about the Twisted-web mailing list