#24382: django.utils.numberformat should be UTF-8 safe
-------------------------------------+-------------------------------------
     Reporter:  jrief                |                    Owner:
         Type:                       |  alainivars
  Cleanup/optimization               |                   Status:  closed
    Component:  Utilities            |                  Version:  1.8alpha1
     Severity:  Normal               |               Resolution:  needsinfo
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  1                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by jrief):

 My concrete problem is an implementation of a class derived from
 ``Decimal``: https://github.com/jrief/django-
 shop/blob/0.3.0.dev/shop/money/money_maker.py

 This class overrides the ``__format__`` method, so that Django's
 ``numberformat`` can render instances of that type in the current locale.
 But my class also uses unicode symbols, for instance the € symbol.
 Therefore strings in ``numberformat`` shall be mixable with unicode
 strings from other modules.

 You can also see it from another perspective.
 Most Python files in Django contain this line:
 ```
 from __future__ import unicode_literals
 ```
 without that line, unicode literals only work with Python-3. By not adding
 this, Django intentionally behaves differently  in Py-2 and Py-3.

--
Ticket URL: <https://code.djangoproject.com/ticket/24382#comment:10>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.6f8d47c8dabb1c144fd2e96194c44825%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to