summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/ipv6.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/utils/ipv6.py b/django/utils/ipv6.py
index eaacfb4623..4d5352272b 100644
--- a/django/utils/ipv6.py
+++ b/django/utils/ipv6.py
@@ -2,10 +2,11 @@
# Copyright 2007 Google Inc. http://code.google.com/p/ipaddr-py/
# Licensed under the Apache License, Version 2.0 (the "License").
from django.core.exceptions import ValidationError
+from django.utils.translation import ugettext_lazy as _
from django.utils.six.moves import xrange
def clean_ipv6_address(ip_str, unpack_ipv4=False,
- error_message="This is not a valid IPv6 address."):
+ error_message=_("This is not a valid IPv6 address.")):
"""
Cleans a IPv6 address string.
@@ -31,7 +32,7 @@ def clean_ipv6_address(ip_str, unpack_ipv4=False,
doublecolon_len = 0
if not is_valid_ipv6_address(ip_str):
- raise ValidationError(error_message)
+ raise ValidationError(error_message, code='invalid')
# This algorithm can only handle fully exploded
# IP strings