On Wed, Jan 27, 2010 at 03:30:18PM +0000, Matthew Wilson wrote:
> def __nonzero__(self):
> return self.count()
This could led to a potential problem in code like this:
if some_condition:
query = MyTable.select(...)
else:
query = None
if query:
...
There is a subtle bug if self.count() returns 0. Currently people are
accustomed that SelectResults instances are always evaluated to True in a
boolean context.
I don't know, though, how often people write code like that.
Oleg.
--
Oleg Broytman http://phd.pp.ru/ [email protected]
Programmers don't die, they just GOSUB without RETURN.
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss