Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#23985 closed Cleanup/optimization (fixed)

URLValidator optional schemes causes backward incompatible changes

Reported by: bruno.devpod Owned by: nobody
Component: Documentation Version: 1.7
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

For people who were using custom regex to restrict uri schemes this new optional feature causes a backwards incompatible change, because any scheme not listed in schemes param will not be validated, even if the regex matches the given url.

It would be nice to have a note in the backward incompatible changes documentation of Django 1.7.

Change History (8)

comment:1 by Baptiste Mispelon, 10 years ago

Component: UncategorizedCore (Other)
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

Hi,

I'm not sure what the benefit of using a URLValidator over a plain Regexvalidator is if you're using a custom regex but still, I think you're right.

The following (simplified) code would pass under Django 1.6 but raises a ValidationError under 1.7:

from django.core.validators import URLValidator

URLValidator(regex='.')('irc://irc.freenode.net/django')

I wonder if there's a way to fix the backwards-compatibility issue rather than documenting it (maybe by disabling schemes if a custom regex has been given but that might not be feasible in practice).
If we can't fix the issue, then we should certainly document it.

Thanks.

comment:2 by Tim Graham, 9 years ago

Component: Core (Other)Documentation

comment:3 by Tim Graham, 9 years ago

Has patch: set

comment:4 by Claude Paroz, 9 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 8c5b8018:

Fixed #23985 -- Documented a backwards incompatible change in URLValidator.

comment:6 by Tim Graham <timograham@…>, 9 years ago

In e20a27b:

[1.8.x] Fixed #23985 -- Documented a backwards incompatible change in URLValidator.

Backport of 8c5b8018f69226389a1373523c41cd37883c9556 from master

comment:7 by Tim Graham <timograham@…>, 9 years ago

In 85a41b4:

[1.7.x] Fixed #23985 -- Documented a backwards incompatible change in URLValidator.

Backport of 8c5b8018f69226389a1373523c41cd37883c9556 from master

comment:8 by Tim Graham <timograham@…>, 9 years ago

In 83607e2b:

[1.9.x] Fixed #23985 -- Documented a backwards incompatible change in URLValidator.

Backport of 8c5b8018f69226389a1373523c41cd37883c9556 from master

Note: See TracTickets for help on using tickets.
Back to Top