#9864: Error message regarding mysql version is never used in the code added by
r9650
------------------------------------------+---------------------------------
Reporter: ElliottM | Owner: nobody
Status: new | Milestone:
Component: Database layer (models, ORM) | Version: 1.0
Keywords: | Stage: Unreviewed
Has_patch: 1 |
------------------------------------------+---------------------------------
In django.db.backends.mysql.validation, there is the following code to
handle validation of varchar fields:
{{{
19 if db_version < (5, 0, 3):
20 msg = '"%(name)s": %(cls)s cannot have a
"max_length" greater than 255 when you are using a version of MySQL prior
to 5.0.3 (you are using %(version)s).'
21 if f.unique == True:
22 msg = '"%(name)s": %(cls)s cannot have a
"max_length" greater than 255 when using "unique=True".'
23 else:
24 msg = None
}}}
If you look carefully, the mysql version ends up being irrelevant. The
cause is the "else" on line 23. The "if" it matches to only tests for
unique=True, so if unique is false then msg will be None, even if the user
has an incompatible mysql version.
To solve it, I removed the else, put "msg=None" above the two if
ststements, then switched the two if statements. The reason for the switch
is that if the user both has a unique field and has an incompatible
version, we want to display the incompatible version error message.
--
Ticket URL: <http://code.djangoproject.com/ticket/9864>
Django <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
-~----------~----~----~----~------~----~------~--~---