On Wed, Jul 8, 2009 at 5:21 PM, Colin Alston <[email protected]>wrote:
> On Wed, Jul 8, 2009 at 4:59 PM, Daniel Yang > <[email protected]>wrote: > >> Hi people, >> >> I am using storm orm(twisted-integration) with Nevow. >> There is a question that confuses me a lot: >> (since storm orm(twisted-integration) does db io in a asynchronous way). >> In a render function, before my data returns, what should I return for the >> render function? >> >> does Nevow has something like server.NOT_DONE_YET? >> or there is a "deferred" way to do this? >> > > Hi, > > You can simply use a deferred in any render function as you would expect. > Nevow deals with this for you. > > def render_foo(self, ctx, data): > Wow.. Google mail fails and I'm too used to using TAB when writing code... def render_foo(self, ctx, data): def continueRendering(results): # do something with results return ctx.tag[whatever] return myDeferredDatabaseQuery(some args).addBoth(continueRendering)
_______________________________________________ Twisted-web mailing list [email protected] http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
