[Twisted-web] Nevow: returning defer.succeed() from the data_*
or render_* method
Jp Calderone
exarkun at divmod.com
Wed Sep 14 13:31:42 MDT 2005
On Tue, 13 Sep 2005 20:14:50 +0400, en.karpachov at ospaz.ru wrote:
>What's wrong with the code below?
>
>from nevow import tags as T, loaders, rend
>from twisted.internet import defer
>
>def simple(ctx, data):
> return defer.succeed("Hello, world!")
>
>class Simple(rend.Page):
> docFactory = loaders.stan(
> T.html[
> T.body[
> T.ul[
> [T.li[ T.invisible(render=simple) ] for _ in xrange(1000)]
> ]
> ]
> ]
> )
>
>I get an exception
>
>"exceptions.RuntimeError: maximum recursion depth exceeded"
>
>rendering this page. It's the defer.succeed what causes this error; if I
>return bare string, all is ok.
>
>Thanks in advance.
>
The way Nevow handles Deferreds means that having a large number of already-fired Deferreds in your document causes many recursive calls to be made. The limit, based on Python's default stack depth limit of 1000, is around 250 Deferreds (probably a slightly fewer). For Deferreds that have not yet fired, this isn't an issue.
Jp
More information about the Twisted-web
mailing list