Opened 2 months ago

Closed 2 months ago

Last modified 10 days ago

#28593 closed New feature (fixed)

DEP 0201: Simplified routing syntax

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

comment:1 Changed 2 months ago by Tim Graham <timograham@…>

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 Changed 2 months ago by Tim Graham

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 Changed 2 months ago by Tim Graham <timograham@…>

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 Changed 8 weeks ago by Tim Graham <timograham@…>

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 Changed 7 weeks ago by Tim Graham <timograham@…>

In f0ffa3f4:

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

comment:6 Changed 7 weeks ago by Tim Graham <timograham@…>

In 5091bb6:

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

Backport of f0ffa3f4ea277f9814285085fde20baff60fc386 from master

comment:7 Changed 10 days ago by Tim Graham <timograham@…>

In 3ae9c356:

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

comment:8 Changed 10 days ago by Tim Graham <timograham@…>

In a977ae9:

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

Backport of 3ae9c356c5d4b89caf8343aa3ffe0a66e713c9fd from master

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