On Sunday 22 August 2010 15:45:22 James Westby wrote:
> On Sun, 22 Aug 2010 20:17:40 +1200, Robert Collins 
<[email protected]> wrote:
> > Amongst other migration issues, __nonzero__ on SQLObjectResultSet
> > makes converting SQLObject to Storm code tricky, because its hard to
> > grep for, silently fails (bool(now-storm-resultset) -> always true).
> 
> Just to note that since the last storm release you can now use
> .is_empty() on either result set, with the same behaviour.
> 
> I would suggest that no new code does bool(SQLObjectResultSet), and
> people convert any instances that they see to .is_empty().
> 
> That will allow a smoother migration, without having to port every use
> by changing the base class.

+1

And as a side note, a useful shortcut in code returning result sets is to 
return EmptyResultSet instead of running the full query if you already know it 
will not return anything, based on other criteria.

_______________________________________________
Mailing list: https://launchpad.net/~launchpad-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to