Re: Potential bug in [Typed]ChoiceField validation mechanism

2010-11-27 Thread ethereon
Forgot to add : The problem can be avoided if both set of values are first normalized, as : >>> Decimal('0.50').normalize() Decimal('0.5') Perhaps this should be internally taken care of, instead of relying on the user to normalize it? On Nov 27, 1:04 pm, ethereon <ether...@gmai

Potential bug in [Typed]ChoiceField validation mechanism

2010-11-27 Thread ethereon
In brief, a [Typed]ChoiceField can reject a valid choice of type Decimal because it is incorrectly compared using smart_unicode. Decimal('0.5')==Decimal('0.50') is true, while '0.5'=='0.50' is false. Verbosely, consider a model defined like so : class Foo(models.Model): BAR_CHOICES