Ticket #13728: 13728_correct_default_value.diff

File 13728_correct_default_value.diff, 1.9 KB (added by suzaku, 5 years ago)

Default values are set according to the document and some changes are made to other code to pass pylint check

  • forms/fields.py

     
    529529        'invalid_link': _(u'This URL appears to be a broken link.'),
    530530    }
    531531
    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,
    533533            validator_user_agent=validators.URL_VALIDATOR_USER_AGENT, *args, **kwargs):
    534534        super(URLField, self).__init__(max_length, min_length, *args,
    535535                                       **kwargs)
  • core/validators.py

     
    4747        r'(?::\d+)?' # optional port
    4848        r'(?:/?|[/?]\S+)$', re.IGNORECASE)
    4949
    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):
    5151        super(URLValidator, self).__init__()
    5252        self.verify_exists = verify_exists
    5353        self.user_agent = validator_user_agent
     
    8282            }
    8383            try:
    8484                req = urllib2.Request(url, None, headers)
    85                 u = urllib2.urlopen(req)
     85                urllib2.urlopen(req)
    8686            except ValueError:
    8787                raise ValidationError(_(u'Enter a valid URL.'), code='invalid')
    8888            except: # urllib2.URLError, httplib.InvalidURL, etc.
     
    106106                parts = value.split(u'@')
    107107                domain_part = parts[-1]
    108108                try:
    109                     parts[-1] = parts[-1].encode('idna')
     109                    domain_part = domain_part.encode('idna')
    110110                except UnicodeError:
    111111                    raise e
    112112                super(EmailValidator, self).__call__(u'@'.join(parts))
Back to Top