Properly track falsy instances in RelationCounterField.

Review Request #9749 — Created March 6, 2018 and submitted

chipx86
Djblets
release-1.0.x
aa1b807...
djblets

RelationCounterField (and parts of CounterField) were testing
instances for truthiness to see if they were valid (i.e., references
haven't dropped), but if an instance defined __nonzero__ or __len__
(with a result of 0), the checks would fail and state would be lost.

These checks have changed to explicitly check against None, ensuring
that we don't accidentally lose anything in these cases, and to add
validity checks in places where they were missing.

While here, I also got rid of a method that was defined that was never
used. It was also assuming validity, and rather than fix it, it was
worth just getting rid of the function.

Unit tests pass. They failed with the addition of a __nonzero__
function in the models prior to these fixes.

brennie
  1. Ship It!
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-1.0.x (948fbdd)
Loading...