diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-07-26 05:18:39 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-07-26 05:18:39 +0000 |
| commit | 108b604b51948a3aa8a5c789887a97eb417d3cb5 (patch) | |
| tree | 0f838bfc8f3853f44b0a82cff132ef0ddce8e794 /django/forms/fields.py | |
| parent | badde8a7e5090347feea0b39221dbdea428582b8 (diff) | |
Fixed #7345 -- When normalising the URLField form field, attach a trailing
slash when only a host (no path) is given. Thanks, jpwatts.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8089 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms/fields.py')
| -rw-r--r-- | django/forms/fields.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/django/forms/fields.py b/django/forms/fields.py index 9e55365210..6b834af0c4 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -7,6 +7,7 @@ import datetime import os import re import time +import urlparse try: from cStringIO import StringIO except ImportError: @@ -539,6 +540,9 @@ class URLField(RegexField): # If no URL scheme given, assume http:// if value and '://' not in value: value = u'http://%s' % value + # If no URL path given, assume / + if value and not urlparse.urlsplit(value).path: + value += '/' value = super(URLField, self).clean(value) if value == u'': return value |
