Ticket #2997: URLField.diff

File URLField.diff, 767 bytes (added by jkocherhans, 18 years ago)
  • django/newforms/fields.py

     
    215215                "User-Agent": self.user_agent,
    216216            }
    217217            try:
    218                 req = urllib2.Request(field_data, None, headers)
     218                req = urllib2.Request(value, None, headers)
    219219                u = urllib2.urlopen(req)
    220220            except ValueError:
    221221                raise ValidationError(u'Enter a valid URL.')
    222             except: # urllib2.URLError, httplib.InvalidURL, etc.
     222            except urllib2.URLError:
    223223                raise ValidationError(u'This URL appears to be a broken link.')
    224224        return value
    225225
Back to Top