Re: [Django Code] #6362: Remove blank spaces with strip when validating the data

6 views
Skip to first unread message

Django Code

unread,
Mar 6, 2008, 5:28:02 PM3/6/08
to djang...@holovaty.com, ja...@jacobian.org, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------+------------------------------------------
Reporter: marinho | Owner: nobody
Status: new | Component: django.newforms
Version: SVN | Resolution:
Keywords: blank space strip | Stage: Unreviewed
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
---------------------------------+------------------------------------------
Comment (by akaihola):

#6717 is about URL fields and leading/trailing spaces specifically.

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:4>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines

Django Code

unread,
Mar 11, 2008, 4:28:04 PM3/11/08
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------+------------------------------------------
Reporter: marinho | Owner: nobody
Status: new | Component: django.newforms
Version: SVN | Resolution:
Keywords: blank space strip | Stage: Design decision needed
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
---------------------------------+------------------------------------------
Changes (by jacob):

* stage: Unreviewed => Design decision needed

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

Django Code

unread,
Aug 5, 2008, 9:16:17 PM8/5/08
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: django.newforms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by zhango):

* cc: al...@zoomget.com (added)

Comment:

+1 on this too please. In usability tests, most of my users accidentally
entered a space in EmailFields and were baffled when the django-based
system threw an error at them, since what they typed looks fine to them.
This happens too often not to be addressed.

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

Django Code

unread,
Aug 9, 2008, 9:17:32 AM8/9/08
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: django.newforms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Comment (by nail.xx <nai...@gmail.com>):

+1 vote. Strip should be performed by default.

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

Django Code

unread,
Aug 10, 2008, 9:33:25 AM8/10/08
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: django.newforms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Comment (by nail.xx <nai...@gmail.com>):

Possible temporary solution is available at
http://www.djangosnippets.org/snippets/956/. But I'm still sure strip
should be done by django as default behavior.

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

Django Code

unread,
Aug 10, 2008, 10:36:25 AM8/10/08
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: django.newforms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Comment (by julianb):

+1. Could be made opt-out, if someone really doesn't like it.

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

Django Code

unread,
Aug 10, 2008, 10:43:09 AM8/10/08
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: django.newforms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Comment (by mtredinnick):

Will everybody please stop putting "+1" style comments. They are *totally*
useless for the purposes of the ticket. Even if 100 people added such a
comment, that's less than .1% of the userbase, so is entirely non-
representative. The resolution will be on the merits, not some straw
count.

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

Django Code

unread,
Sep 4, 2008, 9:21:40 PM9/4/08
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by anonymous):

* has_patch: 0 => 1

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

Django

unread,
Sep 12, 2008, 3:31:32 PM9/12/08
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Comment (by kratorius):

See also #5714 that basically belongs to this.

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

Django

unread,
Oct 17, 2008, 7:39:20 AM10/17/08
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by guettli):

* cc: h...@tbz-pariv.de (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:18>

Django

unread,
Oct 20, 2008, 11:50:06 AM10/20/08
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by hdevries):

* cc: bj...@wasda.nl (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:19>

Django

unread,
Dec 24, 2008, 9:04:47 AM12/24/08
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Comment (by dc):

-1 for the normalize(). It's overkill for simple stripping. And for
complicated normalization better normalize data in form.clean_FIELD() or
write own field subclass with specialized clean() method.

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:20>

Django

unread,
Jan 8, 2009, 11:50:10 AM1/8/09
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:21>

Django

unread,
Jan 8, 2009, 11:52:18 AM1/8/09
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:22>

Django

unread,
Jan 29, 2009, 10:18:18 AM1/29/09
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by olau):

* cc: ol...@iola.dk (added)

Comment:

I sometimes got email from visitors claiming that the user registration
form didn't work as it didn't accept their email address. Took quite a
while to figure out what was wrong. Today I discovered the same problem
with the shopping cart.

Adding a {{{clean_email()}}} method to the form to strip the data doesn't
work as it is run after {{{EmailField}}} does its check. So it's easy to
do the wrong thing, and it's not straightforward to fix.

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:23>

Django

unread,
Jan 29, 2009, 10:26:44 AM1/29/09
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Comment (by marinho):

In my opinion would be simple have an attribute **"keep_blank_spaces"** in
**forms.CharField**, with defaulf value **False**. Then who wants to keep
the blank space just set something like this:

{{{
field = forms.CharField(max_length=20, keep_blank_spaces=True)
}}}

I'm sure most of cases people don't want keep blank spaces at left or
right of cleaned strings.

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:24>

Django

unread,
Jan 30, 2009, 9:43:52 AM1/30/09
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Comment (by julianb):

Replying to [comment:24 marinho]:
> I'm sure most of cases people don't want keep blank spaces at left or
right of cleaned strings.

That might be, but as everyone here was told "Even if 100 people [think
so], that's less than .1% of the userbase, so is entirely non-
representative. The resolution will be on the merits, not some straw
count."

I'm wondering when that is happening.

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:25>

Django

unread,
Jan 30, 2009, 10:37:34 AM1/30/09
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Comment (by marinho):

@julianb

When I said "most of cases" I wasn't meaning "most of us in this
discussion", but '''"most of projects made using Django"'''. And for
exceptional cases, there would be an attribute to set it.

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:26>

Django

unread,
Mar 23, 2009, 7:44:00 AM3/23/09
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by anonymous):

* cc: an...@andybak.net (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:27>

Django

unread,
Mar 31, 2009, 11:32:35 AM3/31/09
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by martin):

* cc: mar...@akoha.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:28>

Django

unread,
May 12, 2009, 7:49:21 PM5/12/09
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by thebitguru):

* cc: far...@thebitguru.com (added)

Comment:

I am also looking for a decision on this (ideally, yes, do it). Posting
to the django developers group for a decision
(http://groups.google.com/group/django-developers/t/90352cc0da78390b).

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:29>

Django

unread,
Dec 27, 2009, 10:53:34 AM12/27/09
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Comment (by hdevries):

2 years after opening this ticket still no decision? Rails' ticket
management is way, way better than Django's.

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:30>

Django

unread,
Jan 15, 2010, 3:39:56 AM1/15/10
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone: 1.2
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by hvdklauw):

* milestone: => 1.2

Comment:

If you call another ticket a duplicate:
http://code.djangoproject.com/ticket/11907
At least make sure the original is still looked at...

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:31>

Django

unread,
Feb 23, 2010, 7:00:16 PM2/23/10
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | 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/6362#comment:32>

Django

unread,
Mar 4, 2010, 12:36:31 AM3/4/10
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by net147):

* cc: net...@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:33>

Django

unread,
May 24, 2010, 9:40:35 PM5/24/10
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by paulc):

* cc: pa...@mozilla.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:34>
Django <http://code.djangoproject.com/>
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 django-...@googlegroups.com.
To unsubscribe from this group, send email to django-update...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.

Django

unread,
Jun 8, 2010, 6:14:07 AM6/8/10
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Comment (by ishirav):

Two and a half years for such a small change? C'mon guys, this really
needs to be fixed.

Here's another use case that would benefit from this: you send an email to
a user with his initial password, or an application license key. When the
user copies the value from their email into a form field on your site,
very often an extra blank slips in and the form validation fails. This is
especially problematic in password fields, since the user can't even see
that there's an extra blank in there. It happened to me several times,
because when you select-by-double-clicking a word in Firefox or
Thunderbird, the blank after the word is included in the selection (try
it!)

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:35>

Django

unread,
Aug 18, 2010, 2:42:59 AM8/18/10
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
---------------------------------------------+------------------------------
Reporter: marinho | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: blank space strip
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by fwenzel):

* cc: fwe...@mozilla.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:36>

Django

unread,
Apr 1, 2011, 3:46:30 AM4/1/11
to djang...@holovaty.com, django-...@googlegroups.com
#6362: Remove blank spaces with strip when validating the data
-------------------------------------+-------------------------------------
Reporter: marinho | Owner: nobody
Type: New | Status: new
feature | Component: Forms
Milestone: | Severity: Normal
Version: SVN | Keywords: blank space strip
Resolution: | Has patch: 1
Triage Stage: Design | Needs tests: 0
decision needed |
Needs documentation: 0 |
Patch needs improvement: 1 |
-------------------------------------+-------------------------------------
Changes (by julien):

* needs_better_patch: 0 => 1
* type: => New feature
* severity: => Normal


Comment:

Tests need to be updated to use unit tests.

--
Ticket URL: <http://code.djangoproject.com/ticket/6362#comment:37>

Reply all
Reply to author
Forward
0 new messages