#3406: [patch] newforms: choices checking should unicode choices list before
comparing to a value
---------------------------------+------------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: adrian
Status: new | Component: django.newforms
Version: SVN | Resolution:
Keywords: unicode | Stage: Unreviewed
Has_patch: 1 | Needs_docs: 0
Needs_tests: 1 | Needs_better_patch: 1
---------------------------------+------------------------------------------
Comment (by [EMAIL PROTECTED]):
Then try this:
{{{
>>> u"превед" == "превед"
Traceback (most recent call last):
File "<stdin>", line 1, in ?
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0:
ordinal not in range(128)
>>> u"превед" in ["превед"]
Traceback (most recent call last):
File "<stdin>", line 1, in ?
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0:
ordinal not in range(128)
}}}
and the code that fails:
{{{
class InvoiceBody(models.Model):
....
UNITS = (
('шт.', 'шт.'),
('мес.', 'мес.'),
)
units = models.CharField(maxlength=10, choices=UNITS)
}}}
and then try to validate a form built using form_for_model()
And btw, you suggest to define choices as unicode strings. Then this line
(original) would do:
{{{
>>> str(u"превед")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5:
ordinal not in range(128)
}}}
Doesn't work either.
--
Ticket URL: <http://code.djangoproject.com/ticket/3406#comment:5>
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
-~----------~----~----~----~------~----~------~--~---