[Twisted-Python] Nevow and twisted.enterprise and deferreds

Christopher Armstrong radix at twistedmatrix.com
Tue May 25 05:26:49 EDT 2004

Alexander May wrote:
> I am using nevow and twisted enterprise and have a situation like this:
> dbPool = adbapi.ConnectionPool('myDB')
> ...
> class MyPage(rend.Page):
>     ...
>     def data_mydata(self, context, data):
>         return dbPool.runQuery("select * from table")

Add an errback to this Deferred that you're returning. 
d.addErrback(self._cbQueryError), and make that method return nevow data 
that can be rendered.

>     def render_myrender(self, context, data):
>         ...
> Happily, and a bit unexpectedly, it worked and the page rendered correctly.
> My issue is if the sql statement fails for some reason the page rendering
> just hangs.  Is there an endorsed way to capture the error and render some
> html from it?  Right now I'd be happy to see the call stack, as I often do
> when an exception occurs.

  Twisted | Christopher Armstrong: International Man of Twistery
   Radix  |          Release Manager,  Twisted Project
---------+           http://radix.twistedmatrix.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20040525/7fa81bf3/attachment.pgp 

More information about the Twisted-Python mailing list