[Django] #11907: EmailField should run strip()

0 views
Skip to first unread message

Django

unread,
Sep 18, 2009, 2:56:03 PM9/18/09
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
-----------------------+----------------------------------------------------
Reporter: whatcould | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: 1.1
Keywords: | Stage: Unreviewed
Has_patch: 0 |
-----------------------+----------------------------------------------------
The EmailField should run strip() to remove opening and trailing spaces
before the validation is run. Copying and pasting an email can easily pick
up a trailing space (I did it myself today).

The code would be something like this, from forms.fields.EmailField. (My
first python, sorry if it's ugly, I'm a rubyist.)

{{{
def clean(self, value):
value = value.strip()
value = super(RegexField, self).clean(value)
return value
}}}

--
Ticket URL: <http://code.djangoproject.com/ticket/11907>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 13, 2010, 6:50:46 AM1/13/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
---------------------------------+------------------------------------------
Reporter: whatcould | Owner: nobody
Status: closed | Milestone:
Component: Forms | Version: 1.1
Resolution: duplicate | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------+------------------------------------------
Changes (by mk):

* status: new => closed
* needs_better_patch: => 0
* resolution: => duplicate
* needs_tests: => 0
* needs_docs: => 0

Comment:

Duplicate of #6362

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:1>

Django

unread,
Feb 4, 2010, 1:25:26 AM2/4/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
---------------------------------+------------------------------------------
Reporter: whatcould | Owner: nobody
Status: reopened | Milestone:
Component: Forms | Version: 1.1
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------+------------------------------------------
Changes (by whatcould):

* status: closed => reopened
* resolution: duplicate =>

Comment:

This is clearly not a duplicate of #6362. Email is a specific kind of data
-- #6362 is the general case. (Which, of course, should also be changed,
but that's not the point here.)

Emails can not have spaces, so the email. Nothing to do with stripping
spaces for other field types.

If the argument against #6362 is that ''sometimes'' you might want spaces
in the data, that argument is moot here, because you would '''never want
spaces in a user-entered email address'''. The examples people brought up
in #6362, appropriately enough, are of users entering emails (with spaces)
and being confused/frustrated.

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:2>

Django

unread,
Feb 4, 2010, 7:16:41 AM2/4/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
--------------------------------+-------------------------------------------
Reporter: whatcould | Owner: nobody
Status: reopened | Milestone: 1.2
Component: Forms | Version: 1.1
Resolution: | Keywords:
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------+-------------------------------------------
Changes (by russellm):

* stage: Unreviewed => Accepted
* milestone: => 1.2

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:3>

Django

unread,
Feb 6, 2010, 5:28:13 PM2/6/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
--------------------------------+-------------------------------------------
Reporter: whatcould | Owner: krisneuharth
Status: new | Milestone: 1.2
Component: Forms | Version: 1.1
Resolution: | Keywords:
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------+-------------------------------------------
Changes (by krisneuharth):

* owner: nobody => krisneuharth
* status: reopened => new

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:4>

Django

unread,
Feb 6, 2010, 5:29:27 PM2/6/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
--------------------------------+-------------------------------------------
Reporter: whatcould | Owner: krisneuharth
Status: new | Milestone: 1.2
Component: Forms | Version: 1.1
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 1 | Needs_tests: 1
Needs_better_patch: 0 |
--------------------------------+-------------------------------------------
Changes (by krisneuharth):

* needs_docs: 0 => 1
* has_patch: 0 => 1
* needs_tests: 0 => 1

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:5>

Django

unread,
Feb 6, 2010, 6:24:43 PM2/6/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
--------------------------------+-------------------------------------------
Reporter: whatcould | Owner: nobody
Status: new | Milestone: 1.2
Component: Forms | Version: 1.1
Resolution: | Keywords:
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------+-------------------------------------------
Changes (by krisneuharth):

* owner: krisneuharth => nobody
* needs_docs: 1 => 0
* has_patch: 1 => 0
* needs_tests: 1 => 0

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:6>

Django

unread,
Feb 6, 2010, 7:05:53 PM2/6/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
--------------------------------+-------------------------------------------
Reporter: whatcould | Owner: djansoft
Status: assigned | Milestone: 1.2
Component: Forms | Version: 1.1
Resolution: | Keywords:
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------+-------------------------------------------
Changes (by djansoft):

* owner: nobody => djansoft
* status: new => assigned

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:7>

Django

unread,
Feb 6, 2010, 7:47:32 PM2/6/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
--------------------------------+-------------------------------------------
Reporter: whatcould | Owner: djansoft
Status: assigned | Milestone: 1.2
Component: Forms | Version: 1.1
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 1 | Needs_tests: 1
Needs_better_patch: 0 |
--------------------------------+-------------------------------------------
Changes (by djansoft):

* needs_docs: 0 => 1
* has_patch: 0 => 1
* needs_tests: 0 => 1

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:8>

Django

unread,
Feb 6, 2010, 8:52:14 PM2/6/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
--------------------------------+-------------------------------------------
Reporter: whatcould | Owner: djansoft
Status: closed | Milestone: 1.2
Component: Forms | Version: 1.1
Resolution: fixed | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------+-------------------------------------------
Changes (by djansoft):

* status: assigned => closed
* needs_docs: 1 => 0
* resolution: => fixed
* needs_tests: 1 => 0

Comment:

Added fix based on krisneuharth's diff. Added test.

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:9>

Django

unread,
Feb 6, 2010, 8:54:00 PM2/6/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
--------------------------------+-------------------------------------------
Reporter: whatcould | Owner: djansoft
Status: reopened | Milestone: 1.2
Component: Forms | Version: 1.1
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------+-------------------------------------------
Changes (by Alex):

* status: closed => reopened
* resolution: fixed =>

Comment:

No patch was committed to Django, tickets are not fixed when a patch is
uploaded.

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:10>

Django

unread,
Feb 23, 2010, 7:19:16 PM2/23/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
--------------------------------+-------------------------------------------
Reporter: whatcould | Owner: djansoft
Status: reopened | Milestone:
Component: Forms | Version: 1.1
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------+-------------------------------------------
Changes (by ubernostrum):

* milestone: 1.2 =>

Comment:

1.2 is feature-frozen, moving this feature request off the milestone.

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:11>

Django

unread,
Feb 24, 2010, 1:40:03 AM2/24/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
--------------------------------+-------------------------------------------
Reporter: whatcould | Owner: djansoft
Status: reopened | Milestone:
Component: Forms | Version: 1.1
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------+-------------------------------------------
Comment (by whatcould):

This sounds a lot like a bug to me, James, not a feature. Emails are
emails, and should be formatted as such. Why do you call the thing "email
field" anyway if you let any old spaces in?

I'd wager users who try to enter emails, include an incidental space, and
then can't log in -- they think it's a bug.

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:12>

Django

unread,
Feb 24, 2010, 7:22:23 AM2/24/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
--------------------------------+-------------------------------------------
Reporter: whatcould | Owner: djansoft
Status: reopened | Milestone:
Component: Forms | Version: 1.1
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------+-------------------------------------------
Comment (by ubernostrum):

Well... actually it's part of (and thus now being closed as a duplicate
of) #6362, which asks for whitespace stripping to be applied before
validating data in all text-based field types. And that's definitely a
feature request, so once again there's no way for this to make it into
1.2. The best way to advance this is to hold on for a bit while 1.2 gets
out the door, then lobby for it to get into 1.3.

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:13>

Django

unread,
Feb 24, 2010, 7:22:31 AM2/24/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
--------------------------------+-------------------------------------------
Reporter: whatcould | Owner: djansoft
Status: closed | Milestone:
Component: Forms | Version: 1.1
Resolution: duplicate | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------+-------------------------------------------
Changes (by ubernostrum):

* status: reopened => closed
* resolution: => duplicate

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:14>

Django

unread,
Feb 24, 2010, 11:14:28 AM2/24/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
--------------------------------+-------------------------------------------
Reporter: whatcould | Owner: djansoft
Status: closed | Milestone:
Component: Forms | Version: 1.1
Resolution: duplicate | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------+-------------------------------------------
Comment (by whatcould):

ubernostrum, if you see my comment above (02/04/10 00:25:26) I explained
why this should be marked as a separate bug, instead of being thrown into
the 2-year-old black hole that is that other bug. Someone else apparently
agreed at the time.

This is all no skin off my back (I was consulting on a django project
that's finished) -- I was just trying to follow through on this bug. Wish
it hadn't felt like pushing on a string.

-whatcould (fellow joyeur)

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:15>

Django

unread,
Oct 7, 2010, 6:16:00 AM10/7/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
--------------------------------+-------------------------------------------
Reporter: whatcould | Owner: djansoft
Status: reopened | Milestone:
Component: Forms | Version: 1.1
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------+-------------------------------------------
Changes (by SmileyChris):

* status: closed => reopened
* resolution: duplicate =>

Comment:

This is in the same basket as #5714 (also originally marked as a dupe of
#6362).

Malcolm reopened that one, so I'm going to reopen this one.

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:16>

Django

unread,
Oct 7, 2010, 6:32:04 AM10/7/10
to djang...@holovaty.com, django-...@googlegroups.com
#11907: EmailField should run strip()
----------------------------------------+-----------------------------------
Reporter: whatcould | Owner: SmileyChris
Status: new | Milestone:
Component: Forms | Version: 1.1
Resolution: | Keywords:
Stage: Ready for checkin | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
----------------------------------------+-----------------------------------
Changes (by SmileyChris):

* owner: djansoft => SmileyChris
* status: reopened => new
* stage: Accepted => Ready for checkin

--
Ticket URL: <http://code.djangoproject.com/ticket/11907#comment:17>
Reply all
Reply to author
Forward
0 new messages