﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7316	Use ugettext_lazy instead of ugettext in contrib.localflavor	Manuel Saelices	Manuel Saelices	"There are many files in {{{localflavor}}} that uses {{{ugettext}}} for defining fields and widgets, for example:
{{{
from django.utils.translation import ugettext

class NOSocialSecurityNumber(Field):
    """"""
    Algorithm is documented at http://no.wikipedia.org/wiki/Personnummer
    """"""
    default_error_messages = {
        'invalid': ugettext(u'Enter a valid Norwegian social security number.'),
    }
...
}}}

This can produce a serious problem (in production server), because two things:
 1. String translation is got in import time, for example when web server starts. This string will never change.
 1. This is the most important problem: You could have error with circulars import, because {{{gettext}}} call will try import all applications installed on Django, but this file haven't loaded yet. I had this problem with Apache for a import cycle, because a {{{contrib.localflavor}}} import. '''This is not acceptable'''.

I will attach a patch for fix this problem."		closed	contrib.localflavor	dev		fixed			Ready for checkin	1	0	0	0	0	0
