String/Unicode type check raises an error when using ugettext_lazy #107

Closed
miguelcb84 opened this Issue Feb 24, 2014 · 1 comment

Projects

None yet

3 participants

@miguelcb84

Checking form_valid_message and form_invalid_message type is incompatible with i18n framework when using ugettext_lazy.

The example below will raise an error because the type of form_valid_message is not either string or unicode. However the code is correct. Moreover, it is the most appropriate (and fastest) way to handle translation in that place.

from django.utils.translation import ugettext_lazy as _

class my_view(FormValidMessageMixin, TemplateView):
    form_valid_message = _("The form is valid")
@chrisjones-brack3t chrisjones-brack3t added this to the 1.4 milestone Mar 1, 2014
@kennethlove kennethlove modified the milestone: 1.4 Mar 1, 2014
@miguelcb84

cool :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment