Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #14941 -- Stop raising ValidationError in form fields that use …

…the URLValidator and get a IDN domain passed. Thanks, Claude Paroz.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15504 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ba1876cef22e46fe4e80ce32547ec9870991b63b 1 parent bc5c253
Jannis Leidel authored February 12, 2011
1  django/core/validators.py
@@ -84,6 +84,7 @@ def __call__(self, value):
84 84
                 "Connection": "close",
85 85
                 "User-Agent": self.user_agent,
86 86
             }
  87
+            url = url.encode('utf-8')
87 88
             broken_error = ValidationError(
88 89
                 _(u'This URL appears to be a broken link.'), code='invalid_link')
89 90
             try:
2  tests/regressiontests/forms/tests/fields.py
@@ -571,6 +571,8 @@ def test_urlfield_3(self):
571 571
             f.clean('http://google.com/we-love-microsoft.html') # good domain, bad page
572 572
         except ValidationError, e:
573 573
             self.assertEqual("[u'This URL appears to be a broken link.']", str(e))
  574
+        # UTF-8 char in path
  575
+        self.assertEqual(u'http://de.wikipedia.org/wiki/T\xfcr', f.clean(u'http://de.wikipedia.org/wiki/T\xfcr'))
574 576
 
575 577
     def test_urlfield_4(self):
576 578
         f = URLField(verify_exists=True, required=False)

0 notes on commit ba1876c

Please sign in to comment.
Something went wrong with that request. Please try again.