Ticket #13728: 13728_correct_default_value.diff
File 13728_correct_default_value.diff, 1.9 KB (added by , 14 years ago) |
---|
-
forms/fields.py
529 529 'invalid_link': _(u'This URL appears to be a broken link.'), 530 530 } 531 531 532 def __init__(self, max_length=None, min_length=None, verify_exists= False,532 def __init__(self, max_length=None, min_length=None, verify_exists=True, 533 533 validator_user_agent=validators.URL_VALIDATOR_USER_AGENT, *args, **kwargs): 534 534 super(URLField, self).__init__(max_length, min_length, *args, 535 535 **kwargs) -
core/validators.py
47 47 r'(?::\d+)?' # optional port 48 48 r'(?:/?|[/?]\S+)$', re.IGNORECASE) 49 49 50 def __init__(self, verify_exists= False, validator_user_agent=URL_VALIDATOR_USER_AGENT):50 def __init__(self, verify_exists=True, validator_user_agent=URL_VALIDATOR_USER_AGENT): 51 51 super(URLValidator, self).__init__() 52 52 self.verify_exists = verify_exists 53 53 self.user_agent = validator_user_agent … … 82 82 } 83 83 try: 84 84 req = urllib2.Request(url, None, headers) 85 u = urllib2.urlopen(req)85 urllib2.urlopen(req) 86 86 except ValueError: 87 87 raise ValidationError(_(u'Enter a valid URL.'), code='invalid') 88 88 except: # urllib2.URLError, httplib.InvalidURL, etc. … … 106 106 parts = value.split(u'@') 107 107 domain_part = parts[-1] 108 108 try: 109 parts[-1] = parts[-1].encode('idna')109 domain_part = domain_part.encode('idna') 110 110 except UnicodeError: 111 111 raise e 112 112 super(EmailValidator, self).__call__(u'@'.join(parts))