GitHub PR with a first try at adding this will follow.
--
Ticket URL: <https://code.djangoproject.com/ticket/28766>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => assigned
* owner: nobody => Benjamin Wohlwend
* has_patch: 0 => 1
Comment:
PR: https://github.com/django/django/pull/9323
--
Ticket URL: <https://code.djangoproject.com/ticket/28766#comment:1>
* stage: Unreviewed => Accepted
Comment:
Thanks for the patch. If it's ready to review you can deassign the Trac
ticket. :)
--
Ticket URL: <https://code.djangoproject.com/ticket/28766#comment:2>
Comment (by Tim Graham):
For URL patterns that use `re_path()` is the route already available from
`ResolverMatch`? If not, I'm unsure why this attribute would only be set
for `path()`.
(By the way, there's no need to deassign the ticket to get it in the
review queue.)
--
Ticket URL: <https://code.djangoproject.com/ticket/28766#comment:3>
Comment (by Benjamin Wohlwend):
Replying to [comment:3 Tim Graham]:
> For URL patterns that use `re_path()` is the route already available
from `ResolverMatch`? If not, I'm unsure why this attribute would only be
set for `path()`.
`re_path()` uses `RegexPattern`, which doesn't have a route, but a regex.
Do you think the regex should be set in that case? That would simplify the
code a bit. Instead of `getattr(pattern._route)`, we could just use
`str(pattern)` (`__str__` prints `_route` for `RoutePattern` objects, and
`_regex` for `RegexPattern`).
--
Ticket URL: <https://code.djangoproject.com/ticket/28766#comment:4>
Comment (by Tim Graham):
Yes, that's what I meant to suggest.
--
Ticket URL: <https://code.djangoproject.com/ticket/28766#comment:5>
Comment (by Benjamin Wohlwend):
OK. However, in that case I think the attribute on `ResolverMatch` should
be named differently, since AFAICT, "route" is specific to the new
simplified URLs from DEP 201. Maybe `ResolverMatch.pattern`?
--
Ticket URL: <https://code.djangoproject.com/ticket/28766#comment:6>
Comment (by Tim Graham):
The first argument of `re_path()` is also documented as `route` so I think
it's okay to use that.
--
Ticket URL: <https://code.djangoproject.com/ticket/28766#comment:7>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/28766#comment:8>
* owner: Benjamin Wohlwend => mes3yd
* needs_better_patch: 1 => 0
* has_patch: 1 => 0
* version: 2.0 => master
Comment:
Working on patch + test + docs.
@tim Do I need to submit a new document for contribution or can you link
the one I submitted already to this [github
account](https://github.com/mes3yd/)? The old account will get closed as
soon as there's nothing pending on it anymore.
--
Ticket URL: <https://code.djangoproject.com/ticket/28766#comment:9>
Comment (by Tim Graham):
You don't need to submit another Contributor License Agreement. Those
agreements are linked to you, not to your GitHub account.
--
Ticket URL: <https://code.djangoproject.com/ticket/28766#comment:10>
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/10657 PR] with comments for
improvement.
--
Ticket URL: <https://code.djangoproject.com/ticket/28766#comment:11>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/28766#comment:12>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"79c196cfb287893aadc6b0e74603ffde1512170e" 79c196cf]:
{{{
#!CommitTicketReference repository=""
revision="79c196cfb287893aadc6b0e74603ffde1512170e"
Fixed #28766 -- Added ResolverMatch.route.
Co-Authored-By: Xavier Fernandez <xavier.f...@polyconseil.fr>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28766#comment:13>