Changes between Initial Version and Version 1 of Ticket #27609


Ignore:
Timestamp:
Dec 16, 2016, 7:45:41 AM (7 years ago)
Author:
Rafał Pitoń
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27609

    • Property Summary UnicodeEncodeError in check_models_permissions for added unicode verbose name to modelsgettext_lazy cast to str/unicode errors under py 2.7 if performed after language activation.
  • Ticket #27609 – Description

    initial v1  
    7272UnicodeEncodeError: 'ascii' codec can't encode character u'\u017c' in position 4: ordinal not in range(128)
    7373}}}
     74
     75- - - - -
     76
     77Upon furthrer look into the issue, it seems that Django uses different strategies on casting variables to strings depending on place. For exaple, gettext_lazy("Branża") works swimmingly when assigned to form's field's verbose_name, but when its used in callable that returns list of field's choices, it raises. Similiarly I've created view like this:
     78
     79{{{
     80# -*- coding: utf-8 -*-
     81from __future__ import unicode_literals
     82
     83from django.utils.translation import gettext_lazy
     84
     85def index(request):
     86    print gettext_lazy('Branża')
     87}}}
     88
     89And it raises too, which points towards gettext_lazy("") changing behaviour after language has been activated.
Back to Top