Re: [Django] #32949: decimal.InvalidOperation error on DecimalField form field

2021-07-21 Thread Django
#32949: decimal.InvalidOperation error on DecimalField form field
-+-
 Reporter:  yakimka  |Owner:  yakimka
 Type:  Bug  |   Status:  closed
Component:  Forms|  Version:  3.2
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Carlton Gibson ):

 In [changeset:"f4cf86f870ed8ab1be2844c0c8f0bbc608154289" f4cf86f8]:
 {{{
 #!CommitTicketReference repository=""
 revision="f4cf86f870ed8ab1be2844c0c8f0bbc608154289"
 [3.2.x] Refs #32949 -- Adjusted release note wording.

 Backport of 012f38f9594b35743e9ab231757b7b62db638323 from main
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.1c64dd14ec05742a0c23eb963d9e34db%40djangoproject.com.


Re: [Django] #32949: decimal.InvalidOperation error on DecimalField form field

2021-07-21 Thread Django
#32949: decimal.InvalidOperation error on DecimalField form field
-+-
 Reporter:  yakimka  |Owner:  yakimka
 Type:  Bug  |   Status:  closed
Component:  Forms|  Version:  3.2
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Carlton Gibson ):

 In [changeset:"012f38f9594b35743e9ab231757b7b62db638323" 012f38f]:
 {{{
 #!CommitTicketReference repository=""
 revision="012f38f9594b35743e9ab231757b7b62db638323"
 Refs #32949 -- Adjusted release note wording.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.3d3b9baed11e7dee2683a394f573f30f%40djangoproject.com.


Re: [Django] #32949: decimal.InvalidOperation error on DecimalField form field

2021-07-21 Thread Django
#32949: decimal.InvalidOperation error on DecimalField form field
-+-
 Reporter:  yakimka  |Owner:  yakimka
 Type:  Bug  |   Status:  closed
Component:  Forms|  Version:  3.2
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Carlton Gibson ):

 In [changeset:"134638176080eba48b9b3a2e484bfee1cb8beaec" 1346381]:
 {{{
 #!CommitTicketReference repository=""
 revision="134638176080eba48b9b3a2e484bfee1cb8beaec"
 [3.2.x] Fixed #32949 -- Restored invalid number handling in
 DecimalField.validate().

 DecimalField must itself validate() values, such as NaN, which cannot be
 passed to validators, such as MaxValueValidator, during the
 run_validators() phase.

 Regression in cc3d24d7d577f174937a0744d886c4c7123cfa85.

 Backport of c542d0a07237033225c1d57337ca9474a00648f2 from main
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.4785328e30d392cde6c6a04147e3a905%40djangoproject.com.


Re: [Django] #32949: decimal.InvalidOperation error on DecimalField form field

2021-07-21 Thread Django
#32949: decimal.InvalidOperation error on DecimalField form field
-+-
 Reporter:  yakimka  |Owner:  yakimka
 Type:  Bug  |   Status:  closed
Component:  Forms|  Version:  3.2
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"c542d0a07237033225c1d57337ca9474a00648f2" c542d0a]:
 {{{
 #!CommitTicketReference repository=""
 revision="c542d0a07237033225c1d57337ca9474a00648f2"
 Fixed #32949 -- Restored invalid number handling in
 DecimalField.validate().

 DecimalField must itself validate() values, such as NaN, which cannot be
 passed to validators, such as MaxValueValidator, during the
 run_validators() phase.

 Regression in cc3d24d7d577f174937a0744d886c4c7123cfa85.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.98c8d33a04828fb1221d190d64d3373c%40djangoproject.com.


Re: [Django] #32949: decimal.InvalidOperation error on DecimalField form field

2021-07-21 Thread Django
#32949: decimal.InvalidOperation error on DecimalField form field
-+-
 Reporter:  yakimka  |Owner:  yakimka
 Type:  Bug  |   Status:  assigned
Component:  Forms|  Version:  3.2
 Severity:  Release blocker  |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson):

 * needs_better_patch:  1 => 0
 * stage:  Accepted => Ready for checkin


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.6af5c6352352d1e85e07c502158bf13c%40djangoproject.com.


Re: [Django] #32949: decimal.InvalidOperation error on DecimalField form field

2021-07-20 Thread Django
#32949: decimal.InvalidOperation error on DecimalField form field
-+
 Reporter:  yakimka  |Owner:  yakimka
 Type:  Bug  |   Status:  assigned
Component:  Forms|  Version:  3.2
 Severity:  Release blocker  |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+
Changes (by Jacob Walls):

 * owner:  nobody => yakimka
 * needs_docs:  1 => 0
 * status:  new => assigned


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.d0595c80afbb2686a23e7284abd1548d%40djangoproject.com.


Re: [Django] #32949: decimal.InvalidOperation error on DecimalField form field

2021-07-20 Thread Django
#32949: decimal.InvalidOperation error on DecimalField form field
-+
 Reporter:  yakimka  |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Forms|  Version:  3.2
 Severity:  Release blocker  |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+
Changes (by Carlton Gibson):

 * needs_better_patch:  0 => 1
 * stage:  Unreviewed => Accepted
 * severity:  Normal => Release blocker
 * needs_docs:  0 => 1


Comment:

 Thanks for the report.

 This is a regression in cc3d24d7d577f174937a0744d886c4c7123cfa85.

 The # originally added handling of `NaN` and `Inf` in `DecimalField`
 (in 692fd7da5e5bfe1533c40f94999ea42f9b986356).
 It looked redundant but wasn't because `MaxValueValidator` does not handle
 `Decimal('NaN')`.

 Here's a minimal diff showing that:

 {{{
 diff --git a/tests/validators/tests.py b/tests/validators/tests.py
 index e39d0e3a1c..42665c6ccb 100644
 --- a/tests/validators/tests.py
 +++ b/tests/validators/tests.py
 @@ -214,6 +214,7 @@ TEST_DATA = [

  (MaxValueValidator(0), 1, ValidationError),
  (MaxValueValidator(NOW), NOW + timedelta(days=1), ValidationError),
 +(MaxValueValidator(Decimal('NaN')), 1, ValidationError),

  (MinValueValidator(-10), -10, None),
  (MinValueValidator(-10), 10, None),
 }}}

 Results in:

 {{{
 ==
 ERROR: test_validators (validators.tests.TestValidators)
 [MaxValueValidator] (value=1)
 --
 Traceback (most recent call last):
   File "...django/tests/validators/tests.py", line 355, in test_validators
 validator(value)
   File "...django/django/core/validators.py", line 358, in __call__
 if self.compare(cleaned, limit_value):
   File "...django/django/core/validators.py", line 383, in compare
 return a > b
 decimal.InvalidOperation: []
 }}}

 You PR here should (partially?) revert
 cc3d24d7d577f174937a0744d886c4c7123cfa85 (see #31806 and
 [https://github.com/django/django/pull/13212/ the PR for discussion and
 related commits]).

 Add `max_value` to the existing `test_enter_a_numer_error()` case:

 {{{
 diff --git a/tests/forms_tests/field_tests/test_decimalfield.py
 b/tests/forms_tests/field_tests/test_decimalfield.py
 index c8b044722e..04c555c4ad 100644
 --- a/tests/forms_tests/field_tests/test_decimalfield.py
 +++ b/tests/forms_tests/field_tests/test_decimalfield.py
 @@ -49,7 +49,7 @@ class DecimalFieldTest(FormFieldAssertionsMixin,
 SimpleTestCase):
  self.assertIsNone(f.min_value)

  def test_enter_a_number_error(self):
 -f = DecimalField(max_digits=4, decimal_places=2)
 +f = DecimalField(max_value=1, max_digits=4, decimal_places=2)
  values = (
 }}}

 It looks as if test `test_value_placeholder_with_decimal_field
 (forms_tests.tests.test_validators.ValidatorCustomMessageTests)` will need
 adjusting.

 A release note in 3.2.6.txt will be needed.
 Good spot.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.035b1a15efc961cd3a6063cf5cef29ee%40djangoproject.com.


Re: [Django] #32949: decimal.InvalidOperation error on DecimalField form field

2021-07-20 Thread Django
#32949: decimal.InvalidOperation error on DecimalField form field
-+--
 Reporter:  yakimka  |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Forms|  Version:  3.2
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--

Comment (by yakimka):

 [https://github.com/django/django/pull/14645 PR]

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.cd61be479dfe40dac5e97d3ab8f9b8b2%40djangoproject.com.


[Django] #32949: decimal.InvalidOperation error on DecimalField form field

2021-07-20 Thread Django
#32949: decimal.InvalidOperation error on DecimalField form field
--+
   Reporter:  yakimka |  Owner:  nobody
   Type:  Bug | Status:  new
  Component:  Forms   |Version:  3.2
   Severity:  Normal  |   Keywords:
   Triage Stage:  Unreviewed  |  Has patch:  1
Needs documentation:  0   |Needs tests:  0
Patch needs improvement:  0   |  Easy pickings:  0
  UI/UX:  0   |
--+
 I have a form with DecimalField and max_value argument:


 {{{
 class OrderForm(forms.ModelForm):
 sum = DecimalField(max_value=12)

 class Meta:
 model = Order
 fields = ['sum']

 # model
 class Order(models.Model):
 sum = models.DecimalField(
 'Sum',
 max_digits=18,
 decimal_places=2,
 default=0
 )
 }}}


 If I pass "NaN" value to this form it will fail with
 decimal.InvalidOperation error.

 https://github.com/django/django/pull/14645

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.2e3739e1c109d60d79e6fa35efcc9c17%40djangoproject.com.