Earlier today, Heikki pointed out to me that Collection's __nonzero__() method was hardcoded to always return True. This was as a workaround for Python to not call __len__() on it which can be costly.

But hardcoding it to return True isn't exactly helpful either. In Python __nonzero__() tends to mean 'not empty'. I hence fixed Collection's __nonzero__() to return False if the collection is empty and True otherwise.

Code that was written, assuming:

  if collection:
     ... # collection is None or some other 'False'-worth object
  else:
     ... # collection is an Item

needs to change to reflect the new meaning:

  if collection:
      ... # collection is not None or an empty collection item
  else:
      ... # collection is None or an empty collection item

There were two occurrences of such code in the functional tests which were fixed accordingly but there could be more in the Chandler codebase...

Andi..
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "chandler-dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/chandler-dev

Reply via email to