Opened 16 years ago
Closed 16 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 |
Description
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. www.cdwow.com%2FDVD
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?
Thanks
Ben...
Note:
See TracTickets
for help on using tickets.
Works for me.
>>> class MyForm(forms.Form): ... url = forms.URLField() >>> data = {'url': 'http://www.awin1.com/cread.php?awinmid=15&awinaffid=81443&clickref=trueblood&p=http%3A%2F%2Fwww.cdwow.com%2FDVD%2Ftrue-blood-series-2%2Fdp%2F8756093%23bc%3Dfbb6'} >>> f = MyForm(data=data) >>> print f.is_valid() True >>> print f.cleaned_data['url'] http://www.awin1.com/cread.php?awinmid=15&awinaffid=81443&clickref=trueblood&p=http%3A%2F%2Fwww.cdwow.com%2FDVD%2Ftrue-blood-series-2%2Fdp%2F8756093%23bc%3Dfbb6