Opened 9 years ago

Closed 9 years ago

#13447 closed (worksforme)

URLField fails validation for a valid URL

Reported by: emson Owned by: nobody
Component: Forms Version: 1.1
Severity: Keywords: fields, urlfield, regex
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The URLField seems to fails validation when it tries to match the following URL:

This is an affiliate link that was automatically generated. The problem seems to be occurring when the regular expression matches the second domain i.e.
Basically the regex thinks that the second domain shouldn't have a '%' after it so fails.

Can you confirm that this is correct with you?


Change History (1)

comment:1 Changed 9 years ago by Russell Keith-Magee

Resolution: worksforme
Status: newclosed

Works for me.

>>> class MyForm(forms.Form):
...     url = forms.URLField()

>>> data = {'url': ''}
>>> f = MyForm(data=data)
>>> print f.is_valid()
>>> print f.cleaned_data['url']
Note: See TracTickets for help on using tickets.
Back to Top