Because a partial function also has arguments provided up front, we need
to handle those specially so that they are accessible in `__repr__`.
ISTM that we can simply unwrap `functools.partial` objects in
`ResolverMatch.__init__()`.
--
Ticket URL: <https://code.djangoproject.com/ticket/32572>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/14155 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/32572#comment:1>
* status: assigned => closed
* type: Bug => Cleanup/optimization
* resolution: => wontfix
Comment:
Nick, thanks for this proposition. However I agree with
[https://github.com/django/django/pull/14155/files#r598304014 Tim's
comment], the improvement is not worth the breaking change.
--
Ticket URL: <https://code.djangoproject.com/ticket/32572#comment:2>
* status: closed => new
* resolution: wontfix =>
Old description:
> When a partial function is passed as the view, the `__repr__` shows the
> `func` argument as `functools.partial` which isn't very helpful,
> especially as it doesn't reveal the underlying function or arguments
> provided.
>
> Because a partial function also has arguments provided up front, we need
> to handle those specially so that they are accessible in `__repr__`.
>
> ISTM that we can simply unwrap `functools.partial` objects in
> `ResolverMatch.__init__()`.
New description:
When a partial function is passed as the view, the `__repr__` shows the
`func` argument as `functools.partial` which isn't very helpful,
especially as it doesn't reveal the underlying function or arguments
provided.
Because a partial function also has arguments provided up front, we need
to handle those specially so that they are accessible in `__repr__`.
~~ISTM that we can simply unwrap `functools.partial` objects in
`ResolverMatch.__init__()`.~~
--
Comment:
Reopening with a different approach based on my
[https://github.com/django/django/pull/14155#discussion_r602380807
comment].
--
Ticket URL: <https://code.djangoproject.com/ticket/32572#comment:3>
* status: new => assigned
* stage: Unreviewed => Accepted
Comment:
Improving `__repr__()` sounds good to me.
--
Ticket URL: <https://code.djangoproject.com/ticket/32572#comment:4>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/32572#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"41850eec99366a51f98123f7c51e5bc5a8b2798c" 41850eec]:
{{{
#!CommitTicketReference repository=""
revision="41850eec99366a51f98123f7c51e5bc5a8b2798c"
Fixed #32572 -- Improved ResolverMatch.__repr__().
When a partial function was passed as the view, the __repr__() would
show the `func` argument as `functools.partial` which isn't very
helpful, especially as it doesn't reveal the underlying function or
arguments provided.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32572#comment:6>