On Friday 23 September 2011 18:22:11 Gary Poster wrote:
> from lp.testing import StormStatementRecorder
> 
> with StormStatementRecorder() as recorder:
>     ...code that touches the DB goes here...
> 
> print recorder

This is cool!

> You can conditionally get tracebacks by passing a callable that receives a
> SQL query string and returns a boolean True if a traceback should be
> collected, and False if it should not. The SQL will be normalized to
> capitalization and space normalized. For example,
> StormStatementRecorder(lambda sql: 'STRUCTURALSUBSCRIPTION' in sql) would
> get you tracebacks when the SQL has something to do with structural
> subscriptons.

But this is awesomely unbelieveably useful, thanks Gary!

_______________________________________________
Mailing list: https://launchpad.net/~launchpad-dev
Post to     : launchpad-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to