1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

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
This commit is contained in:
Malcolm Tredinnick
2008-07-26 05:18:39 +00:00
parent badde8a7e5
commit 108b604b51
2 changed files with 26 additions and 13 deletions

View File

@@ -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