#27486: intword and filesizeformat filters shouldn't pass non-integers to 
gettext
-------------------------------------+-------------------------------------
     Reporter:  Tim Graham           |                    Owner:  Mariusz
         Type:                       |  Felisiak <felisiak.mariusz@…>
  Cleanup/optimization               |                   Status:  closed
    Component:  Template system      |                  Version:  master
     Severity:  Normal               |               Resolution:  fixed
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

 * status:  new => closed
 * owner:  (none) => Mariusz Felisiak <felisiak.mariusz@…>
 * resolution:   => fixed


Comment:

 In [changeset:"9e38ed0536c7dc598a6c2c1bb774d0a8db3cdddc" 9e38ed05]:
 {{{
 #!CommitTicketReference repository=""
 revision="9e38ed0536c7dc598a6c2c1bb774d0a8db3cdddc"
 Fixed #27486 -- Fixed Python 3.7 DeprecationWarning in intword and
 filesizeformat filters.

 intword and filesizeformat passed floats to ngettext() which is
 deprecated in Python 3.7. The rationale for this warning is documented
 in BPO-28692: https://bugs.python.org/issue28692.

 For filesizeformat, the filesize value is expected to be an int -- it
 fills %d string formatting placeholders. It was likely coerced to a
 float to ensure floating point division on Python 2. Python 3 always
 does floating point division, so coerce to an int instead of a float to
 fix the warning.

 For intword, the number may contain a decimal component. In English, a
 decimal component makes the noun plural. A helper function,
 round_away_from_one(), was added to convert the float to an integer that
 is appropriate for ngettext().
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/27486#comment:6>
Django <https://code.djangoproject.com/>
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.6d0658d11b080da72d819f640e4c4c20%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to