Max. size of User.email is 75 chars

4 views
Skip to first unread message

Peter Melvyn

unread,
Aug 30, 2007, 3:42:33 AM8/30/07
to Django developers
Hi all,

I've a question, why max. size of User.email field is set to 75
characters,
if RFC 2821 limits local part to 64 characters and domain to 255.
With '@' it is together 320 chars.

Should not be this field extended?

SmileyChris

unread,
Aug 30, 2007, 5:42:50 AM8/30/07
to Django developers
It has always made me wonder why it isn't even overridable. Is there a
design decision behind this or has it just never been asked?

Russell Keith-Magee

unread,
Aug 30, 2007, 7:01:14 AM8/30/07
to django-d...@googlegroups.com
On 8/30/07, SmileyChris <smile...@gmail.com> wrote:
>
> It has always made me wonder why it isn't even overridable. Is there a
> design decision behind this or has it just never been asked?

I don't see why it needs to be configurable. Email have a fixed finite
maximum length - it isn't something that requires configuration on a
per-site basis.

75 characters has certainly served me well enough as a max_length, but
if the RFC allows up to 320, then we should probably look at changing
the default. However, this will be a backwards incompatible change
(not a particularly worrisome one), so we need to consider the
benefits.

Put me down as a +0. For completeness, the change is desirable, but I
can't say I've come across many 320 character email addresses in my
time. If it didn't change, I don't know that I would be too worried.

Yours,
Russ Magee %-)

Malcolm Tredinnick

unread,
Aug 30, 2007, 7:47:53 AM8/30/07
to django-d...@googlegroups.com
On Thu, 2007-08-30 at 19:01 +0800, Russell Keith-Magee wrote:
> On 8/30/07, SmileyChris <smile...@gmail.com> wrote:
> >
> > It has always made me wonder why it isn't even overridable. Is there a
> > design decision behind this or has it just never been asked?
>
> I don't see why it needs to be configurable. Email have a fixed finite
> maximum length - it isn't something that requires configuration on a
> per-site basis.

I agree. -1 on making it customizable.

In the very rare case where somebody really needs another value, it will
easy to roll their own using a TextField and the right validator and
form widget.

> 75 characters has certainly served me well enough as a max_length, but
> if the RFC allows up to 320, then we should probably look at changing
> the default. However, this will be a backwards incompatible change
> (not a particularly worrisome one), so we need to consider the
> benefits.
>
> Put me down as a +0. For completeness, the change is desirable, but I
> can't say I've come across many 320 character email addresses in my
> time. If it didn't change, I don't know that I would be too worried.

I'm probably about +0.5 on making the change prior to 1.0 at some point.
It will be harder to change later. 320 is way too big in practice, but
there's only one reason I would hesitate to pick it as a value: if any
database servers we support have larger storage requirements beyond 255
characters (MySQL in some version springs to mind, but I can't remember
the version numbers). A sane server will implement a VARCHAR (or
equivalent) field as a length plus data, so all values are pretty much
the same.

Regards,
Malcolm

--
Depression is merely anger without enthusiasm.
http://www.pointy-stick.com/blog/

Clint Ecker

unread,
Aug 30, 2007, 8:50:43 AM8/30/07
to django-d...@googlegroups.com
Just as a data point, I've only run into this issue exactly one time.
The guy had an 80-character email address.

It was kind of a pain to have to override everything everywhere in my
production app, but I only had to do it once, so... it's not too high
on my list of things that have ever annoyed me :)

Clint


--
Clint Ecker
Sr. Web Developer - Stone Ward Chicago
p: 312.464.1443
c: 312.863.9323
---
twitter: clint
skype: clintology
AIM: idiosyncrasyFG
Gtalk: clint...@gmail.com

SmileyChris

unread,
Aug 30, 2007, 5:38:26 PM8/30/07
to Django developers
On Aug 30, 11:47 pm, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:

> On Thu, 2007-08-30 at 19:01 +0800, Russell Keith-Magee wrote:
> > On 8/30/07, SmileyChris <smileych...@gmail.com> wrote:
>
> > > It has always made me wonder why it isn't even overridable. Is there a
> > > design decision behind this or has it just never been asked?
>
> > I don't see why it needs to be configurable. Email have a fixed finite
> > maximum length - it isn't something that requires configuration on a
> > per-site basis.
>
> I agree. -1 on making it customizable.

Ok, fair enough. But 75 isn't long enough, and if we don't want to go
up to 320 then what length should it be? 255?

Tai Lee

unread,
Aug 31, 2007, 9:44:14 PM8/31/07
to Django developers
It should probably be 320, and if there are any databases that don't
support a field that long, it should be reduced to accomodate those
databases (only), rather than holding everything back for the lowest
common denominator?

Gary Wilson

unread,
Aug 31, 2007, 9:55:20 PM8/31/07
to django-d...@googlegroups.com

I don't see the harm in allowing a max_length parameter to be specified,
similar to how the URLField was changed a while back [1]. IMO, this is the
sort of thing frameworks are good for; make the common things easy and the
not-so-common things possible. No matter how high we raise the default,
someone's always going to want/need more.

So count me as +1 for allowing max_length, keeping the default at 75, no
backwards incompatibility, and never having to deal with this issue again.

Gary

[1] http://code.djangoproject.com/ticket/1477

Reply all
Reply to author
Forward
0 new messages