Re: [Django] #36796: URL resolution breaks if route defined with lazy string and uses an include

5 views
Skip to first unread message

Django

unread,
Dec 12, 2025, 10:14:18 AM (4 days ago) Dec 12
to django-...@googlegroups.com
#36796: URL resolution breaks if route defined with lazy string and uses an include
------------------------------------+------------------------------------
Reporter: Andrea Angelini | Owner: (none)
Type: Bug | Status: new
Component: Core (URLs) | Version: 6.0
Severity: Release blocker | Resolution:
Keywords: gettext_lazy, lazy | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+------------------------------------
Comment (by Andrea Angelini):

Amended like following fixes this issue:

{{{
elif path.startswith(str(self._route)):
return path.removeprefix(str(self._route)), (), {}
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36796#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 12, 2025, 10:19:05 AM (4 days ago) Dec 12
to django-...@googlegroups.com
#36796: URL resolution breaks if route defined with lazy string and uses an include
------------------------------------+------------------------------------
Reporter: Andrea Angelini | Owner: (none)
Type: Bug | Status: new
Component: Core (URLs) | Version: 6.0
Severity: Release blocker | Resolution:
Keywords: gettext_lazy, lazy | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+------------------------------------
Comment (by Jake Howard):

I'd missed that lazy string were accepted, and surprised a test didn't
cover this behaviour.

Just handling the `elif` case won't quite work, since there's also the
endpoint case. Converting `self._route` to a string (as part of `match`,
rather than the constructor so it's evaluated in the correct context)
sounds like the right solution. It'd be nice if the conversion only
happens once per `match` to avoid unnecessary extra work.
--
Ticket URL: <https://code.djangoproject.com/ticket/36796#comment:4>

Django

unread,
Dec 12, 2025, 10:28:29 AM (4 days ago) Dec 12
to django-...@googlegroups.com
#36796: URL resolution breaks if route defined with lazy string and uses an include
------------------------------------+------------------------------------
Reporter: Andrea Angelini | Owner: (none)
Type: Bug | Status: new
Component: Core (URLs) | Version: 6.0
Severity: Release blocker | Resolution:
Keywords: gettext_lazy, lazy | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+------------------------------------
Comment (by Andrea Angelini):

I agree with you that it should be converted to a string as part of
`match`
--
Ticket URL: <https://code.djangoproject.com/ticket/36796#comment:5>

Django

unread,
Dec 12, 2025, 10:34:19 AM (4 days ago) Dec 12
to django-...@googlegroups.com
#36796: URL resolution breaks if route defined with lazy string and uses an include
------------------------------------+------------------------------------
Reporter: Andrea Angelini | Owner: (none)
Type: Bug | Status: new
Component: Core (URLs) | Version: 6.0
Severity: Release blocker | Resolution:
Keywords: gettext_lazy, lazy | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+------------------------------------
Comment (by Andrea Angelini):

In the endpoint seems to work though because `gettext_lazy('test') ==
'test'` return `True`
--
Ticket URL: <https://code.djangoproject.com/ticket/36796#comment:6>

Django

unread,
Dec 14, 2025, 12:14:08 AM (3 days ago) Dec 14
to django-...@googlegroups.com
#36796: URL resolution breaks if route defined with lazy string and uses an include
-------------------------------------+-------------------------------------
Reporter: Andrea Angelini | Owner: Kundan
| Yadav
Type: Bug | Status: assigned
Component: Core (URLs) | Version: 6.0
Severity: Release blocker | Resolution:
Keywords: gettext_lazy, lazy | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Kundan Yadav):

* owner: (none) => Kundan Yadav
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/36796#comment:7>

Django

unread,
Dec 15, 2025, 2:53:19 PM (23 hours ago) Dec 15
to django-...@googlegroups.com
#36796: URL resolution breaks if route defined with lazy string and uses an include
-------------------------------------+-------------------------------------
Reporter: Andrea Angelini | Owner: Kundan
| Yadav
Type: Bug | Status: assigned
Component: Core (URLs) | Version: 6.0
Severity: Release blocker | Resolution:
Keywords: gettext_lazy, lazy | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* has_patch: 0 => 1

Comment:

[https://github.com/django/django/pull/20403 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/36796#comment:8>

Django

unread,
Dec 15, 2025, 4:43:04 PM (22 hours ago) Dec 15
to django-...@googlegroups.com
#36796: URL resolution breaks if route defined with lazy string and uses an include
-------------------------------------+-------------------------------------
Reporter: Andrea Angelini | Owner: Kundan
| Yadav
Type: Bug | Status: assigned
Component: Core (URLs) | Version: 6.0
Severity: Release blocker | Resolution:
Keywords: gettext_lazy, lazy | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 0 => 1
* needs_tests: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36796#comment:9>
Reply all
Reply to author
Forward
0 new messages