Opened 13 years ago

Closed 12 years ago

#17870 closed Bug (fixed)

Documentation for EmailField max_length

Reported by: Joe Tennies Owned by: Joe Tennies
Component: Documentation Version: 1.4-beta-1
Severity: Normal Keywords:
Cc: joe@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

There has been discussion on the Django-develop mailing list about the default max_length of the EmailField. The RFCs allow for 254 octets. This can allow for a maximum of 254 characters. Post 1.4, someone may decide to have the EmailField properly handle the encoding information if a character would use multiple bytes, but in the meantime the documentation should be updated to add the following note to the EmailField.

The default 75 character max_length is not capable of storing all RFC3696/5321 email addresses. A max_length of 254 would be capable of storing all email addresses as defined by the RFC3696/5321 specification. This is not being changed at this time to maintain backwards compatibility.

Attachments (2)

Ticket17870.patch (1.3 KB ) - added by Joe Tennies 13 years ago.
Patches documentation and adds comment to init of models.EmailField
Ticket17870-2.patch (1.3 KB ) - added by Joe Tennies 13 years ago.
Updated to RKM's wording

Download all attachments as: .zip

Change History (5)

comment:1 by Russell Keith-Magee, 13 years ago

Triage Stage: UnreviewedReady for checkin

To be clear: the proposal is to add the new text as a a note/admonition to the EmailField API reference. Marking RFC because it's a simple addition, and it's worth pointing out this constraint.

However, I'd slightly modify the text:

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

by Joe Tennies, 13 years ago

Attachment: Ticket17870.patch added

Patches documentation and adds comment to init of models.EmailField

comment:2 by Joe Tennies, 13 years ago

Cc: joe@… added
Has patch: set

Just saw your comment, Russell. I changed the wording when I redid it to the following before seeing your comment:

Incompliance to RFCs

The default value of max_length is not compliant with RFCs 3696 and 5321. It is suggested that new projects override the max_length to 254 characters, as this would be capable of storing all email addresses as defined by RFCs 3696 and 5321.

The default value is not being changed at this time to maintain backward compatibility with previous versions of Django.

by Joe Tennies, 13 years ago

Attachment: Ticket17870-2.patch added

Updated to RKM's wording

comment:3 by Claude Paroz, 12 years ago

Resolution: fixed
Status: newclosed

In [17826]:

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.

Note: See TracTickets for help on using tickets.
Back to Top