#3344: newforms UnicodeEncodeError in EmailField on non-successful validation
------------------------------------------------------------+---------------
Reporter: bartekr |
Owner: adrian
Status: new |
Component: django.newforms
Version: SVN |
Resolution:
Keywords: UnicodeEncodeError EmailField gettext Polish |
Stage: Accepted
Has_patch: 0 |
Needs_docs: 0
Needs_tests: 0 |
Needs_better_patch: 0
------------------------------------------------------------+---------------
Changes (by adrian):
* stage: Unreviewed => Accepted
Old description:
> newforms EmailField causes UnicodeEncodeError exception in case when
> value isn't correct.
>
> Exception Type: UnicodeEncodeError
> Exception Value: 'ascii' codec can't encode character u'\u017a' in
> position 33: ordinal not in range(128)
> Exception Location:
> /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/
> site-packages/django/newforms/forms.py in _html_output, line 103
>
> I spent some time for debugging and I found that what probably causes the
> error is:
>
> {{{
> RegexField.__init__(self, email_re, max_length, min_length,
> gettext(u'Enter a valid e-mail address.'), required, widget, label,
> initial)
> }}}
> newforms/fields.py, line 267 (rev. 4386)
>
> When for debug purposes I changed gettext(u'Enter a valid e-mail
> address.') to anything else (ex. gettext(u'aaa')), the problem didn't
> occur and the 'aaa' validation error message was displayed like it
> should. This is probably a problem with translation file or so, but I'm
> just a Python/django/gettext newbie and I'm just starting my adventure
> with all of them, so I'm unable to debug it more.
New description:
newforms EmailField causes UnicodeEncodeError exception in case when value
isn't correct.
{{{
Exception Type: UnicodeEncodeError
Exception Value: 'ascii' codec can't encode character u'\u017a' in
position 33: ordinal not in range(128)
Exception Location:
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/
site-packages/django/newforms/forms.py in _html_output, line 103
}}}
I spent some time for debugging and I found that what probably causes the
error is:
{{{
RegexField.__init__(self, email_re, max_length, min_length,
gettext(u'Enter a valid e-mail address.'), required, widget, label,
initial)
}}}
newforms/fields.py, line 267 (rev. 4386)
When for debug purposes I changed gettext(u'Enter a valid e-mail
address.') to anything else (ex. gettext(u'aaa')), the problem didn't
occur and the 'aaa' validation error message was displayed like it should.
This is probably a problem with translation file or so, but I'm just a
Python/django/gettext newbie and I'm just starting my adventure with all
of them, so I'm unable to debug it more.
Comment:
Fixed formatting in description.
--
Ticket URL: <http://code.djangoproject.com/ticket/3344#comment:3>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---