Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#28593 closed New feature (fixed)

DEP 0201: Simplified routing syntax

Reported by: Tim Graham Owned by: nobody
Component: Core (URLs) Version: dev
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

Change History (9)

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

In ee4043f:

Refs #28593 -- Moved django.conf.urls.include() to django.urls().

The old location remains for backwards compatibility. Documentation
will be updated separately along with the rest of the URL routing changes.

comment:2 by Tim Graham, 7 years ago

Has patch: set
Triage Stage: AcceptedReady for checkin

The code work happened at PR 7482 and the documentation at PR 7542 and later PR 9072.

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

Resolution: fixed
Status: newclosed

In df41b5a0:

Fixed #28593 -- Added a simplified URL routing syntax per DEP 0201.

Thanks Aymeric Augustin for shepherding the DEP and patch review.
Thanks Marten Kenbeek and Tim Graham for contributing to the code.
Thanks Tom Christie, Shai Berger, and Tim Graham for the docs.

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

In 6f7279c:

Refs #28593 -- Made URLResolver._populate() more resilient to signal interrupts.

_populate() sets the populating attribute to prevent infinite recursion in
case a urlconf includes itself. The flag is a threadlocal to avoid a race
condition [1] where one thread sets the flag and another checks it, then
proceeds to access data that's supposed to be populated (e.g. _reverse_dict)
but isn't yet.

The potential still exists for a thread to set the threadlocal, then be
interrupted by a signal such as SIGALRM and raise before resetting the
threadlocal flag. In this scenario, subsequent calls to _populate() in the
same thread will short-circuit erroneously.

The bulk of the method was already wrapped in a try/finally in df41b5a, but
since a signal interrupt can occur at any line executed by the interpreter,
this moves up the try to ensure threadlocal gets reset.

[1]: https://groups.google.com/d/msg/django-developers/D_bIeinKHjE/4NmVQUJqAgAJ

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

In f0ffa3f4:

Refs #27025, #28593 -- Fixed "invalid escape sequence" warnings in urls/resolvers.py.

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

In 5091bb6:

[2.0.x] Refs #27025, #28593 -- Fixed "invalid escape sequence" warnings in urls/resolvers.py.

Backport of f0ffa3f4ea277f9814285085fde20baff60fc386 from master

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

In 3ae9c356:

Refs #28593 -- Updated old class names in comments following URL routing changes.

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

In a977ae9:

[2.0.x] Refs #28593 -- Updated old class names in comments following URL routing changes.

Backport of 3ae9c356c5d4b89caf8343aa3ffe0a66e713c9fd from master

comment:9 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

In 7619a336:

Refs #28593 -- Changed url() to path() in comments following URL routing changes.

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