diff --git a/django/utils/ipv6.py b/django/utils/ipv6.py
index 7624bb9..4cce85e 100644
a
|
b
|
|
1 | 1 | # This code was mostly based on ipaddr-py |
2 | 2 | # Copyright 2007 Google Inc. http://code.google.com/p/ipaddr-py/ |
3 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"). |
| 4 | import string |
| 5 | |
4 | 6 | from django.core.exceptions import ValidationError |
5 | 7 | from django.utils.six.moves import xrange |
6 | 8 | |
… |
… |
def is_valid_ipv6_address(ip_str):
|
154 | 156 | """ |
155 | 157 | from django.core.validators import validate_ipv4_address |
156 | 158 | |
| 159 | # No whitespaces allowed |
| 160 | if any(c in string.whitespace for c in ip_str): |
| 161 | return False |
| 162 | |
157 | 163 | # We need to have at least one ':'. |
158 | 164 | if ':' not in ip_str: |
159 | 165 | return False |
diff --git a/tests/modeltests/validators/tests.py b/tests/modeltests/validators/tests.py
index 0174a60..84dc19c 100644
a
|
b
|
TEST_DATA = (
|
67 | 67 | (validate_ipv4_address, '25.1.1.', ValidationError), |
68 | 68 | (validate_ipv4_address, '25,1,1,1', ValidationError), |
69 | 69 | (validate_ipv4_address, '25.1 .1.1', ValidationError), |
| 70 | (validate_ipv4_address, ' 1.1.1.1', ValidationError), |
70 | 71 | |
71 | 72 | # validate_ipv6_address uses django.utils.ipv6, which |
72 | 73 | # is tested in much greater detail in it's own testcase |
… |
… |
TEST_DATA = (
|
77 | 78 | (validate_ipv6_address, '1:2', ValidationError), |
78 | 79 | (validate_ipv6_address, '::zzz', ValidationError), |
79 | 80 | (validate_ipv6_address, '12345::', ValidationError), |
| 81 | (validate_ipv6_address, ' fe80::1', ValidationError), |
| 82 | (validate_ipv6_address, 'fe80 ::1', ValidationError), |
80 | 83 | |
81 | 84 | (validate_ipv46_address, '1.1.1.1', None), |
82 | 85 | (validate_ipv46_address, '255.0.0.0', None), |