[Twisted-web] renderer returning an errored deferred makes the response hang

Drew Perttula drewp at bigasterisk.com
Thu Dec 20 01:28:00 EST 2007

This page prints an error to the console, but the page never terminates. 
Rendering 'bar' behaves how I would expect-- an error page is shown in 
the browser.

How can I cause error pages to display when any renderer errors (or even 
replace that renderer with a local error message)? Having my site hang 
is awkward for debugging.

import sys
from twisted.internet.defer import Deferred
from twisted.internet import reactor
from twisted.python import log
from nevow.appserver import NevowSite
from nevow import rend, loaders, tags as T
import nevow

class P(rend.Page):
     docFactory = loaders.stan(T.body[T.directive('foo')])
     def render_foo(self, ctx, data):
         d = Deferred()
         def e(result):
             raise ValueError
         return d

     def render_bar(self, ctx, data):
         raise ValueError

print nevow.__file__, nevow.__version__
reactor.listenTCP(8006, NevowSite(P()))

More information about the Twisted-web mailing list