[Twisted-Python] Deferred model

Syver Enstad syver-en at online.no
Thu Nov 13 08:29:28 EST 2003

Philippe Lafoucrière <lafou at wanadoo.fr> writes:

> Hello
> Can someone provide me a good example of a deferred model in woven ?
> I have a big model to build, and the page takes a long time to
> render...

from twisted.web.woven.page import Page
from twised.internet import defer

class OurPage(Page):
    template = '''<html><body>
    <p model="deferredModel" view="Text"></p>
    def wmfactory_deferredModel(self, request):
        """ returns an already callbacked
        Deferred with the string 'Hello world' as it's result
        return defer.succeed('Hello world')



Syver Enstad

More information about the Twisted-Python mailing list