#32572: ResolverMatch.__repr__() doesn't handle functools.partial() nicely.
-------------------------------------+-------------------------------------
     Reporter:  Nick Pope            |                    Owner:  Nick Pope
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Core (URLs)          |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:  __repr__             |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Nick Pope):

 * 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>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.97f128087b3bace2420342a92782ec40%40djangoproject.com.

Reply via email to