Author: claudep
Date: 2012-03-29 11:39:21 -0700 (Thu, 29 Mar 2012)
New Revision: 17826

Modified:
   django/trunk/django/db/models/fields/__init__.py
   django/trunk/docs/ref/models/fields.txt
Log:
Fixed #17870 -- Documented that EmailField default max_length of 75 does not 
comply with RFCs 3696/5321. Thanks Rotund for the report and the patch and 
Russell Keith-Magee for the review.


Modified: django/trunk/django/db/models/fields/__init__.py
===================================================================
--- django/trunk/django/db/models/fields/__init__.py    2012-03-29 16:49:59 UTC 
(rev 17825)
+++ django/trunk/django/db/models/fields/__init__.py    2012-03-29 18:39:21 UTC 
(rev 17826)
@@ -890,6 +890,9 @@
     description = _("E-mail address")
 
     def __init__(self, *args, **kwargs):
+        # max_length should be overridden to 254 characters to be fully 
+        # compliant with RFCs 3696 and 5321
+
         kwargs['max_length'] = kwargs.get('max_length', 75)
         CharField.__init__(self, *args, **kwargs)
 

Modified: django/trunk/docs/ref/models/fields.txt
===================================================================
--- django/trunk/docs/ref/models/fields.txt     2012-03-29 16:49:59 UTC (rev 
17825)
+++ django/trunk/docs/ref/models/fields.txt     2012-03-29 18:39:21 UTC (rev 
17826)
@@ -481,6 +481,15 @@
 
 A :class:`CharField` that checks that the value is a valid email address.
 
+.. admonition:: Incompliance to RFCs
+
+    The default 75 character ``max_length`` is not capable of storing all
+    possible RFC3696/5321-compliant email addresses. In order to store all 
+    possible valid email addresses, a ``max_length`` of 254 is required. 
+    The default ``max_length`` of 75 exists for historical reasons. The 
+    default has not been changed in order to maintain backwards 
+    compatibility with existing uses of :class:`EmailField`.
+
 ``FileField``
 -------------
 

-- 
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.

Reply via email to