#2129: the validate() method shouldn't ignore maxlength
----------------------------+-----------------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: adrian
Type: defect | Status: new
Priority: normal | Milestone:
Component: Validators | Version: SVN
Severity: normal | Keywords:
----------------------------+-----------------------------------------------
The validate() method of a model does not complain when exceeding the
maxlength of a CharField.
There should be an error in the returned dictionary (e.g. "Ensure your
text is less than 75 characters.")
In the following example someone could add an invalid e-mail-address
without getting a validation error:
{{{
>>> import django.contrib.auth.models as auth
>>> u = auth.User.objects.get(pk=1)
>>> u.email =
'[EMAIL PROTECTED]'
>>> u.validate()
{}
>>> u.save()
/usr/lib/python2.3/site-packages/django/db/backends/mysql/base.py:35:
Warning: Rows matched: 1 Changed: 1 Warnings: 1
return self.cursor.execute(sql, params)
>>> u.validate()
{}
>>> u = auth.User.objects.get(pk=1)
>>> u.email
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
>>> u.validate()
{'email': ['Enter a valid e-mail address.']}
>>>
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/2129>
Django <http://code.djangoproject.org/>
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
-~----------~----~----~----~------~----~------~--~---