Opened 5 years ago
Closed 5 years ago
#32572 closed Cleanup/optimization (fixed)
ResolverMatch.__repr__() doesn't handle functools.partial() nicely.
| Reported by: | Nick Pope | Owned by: | Nick Pope |
|---|---|---|---|
| Component: | Core (URLs) | Version: | dev |
| Severity: | Normal | Keywords: | __repr__ |
| 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 (last modified by )
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__().
Change History (6)
comment:1 by , 5 years ago
| Has patch: | set |
|---|
comment:2 by , 5 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | assigned → closed |
| Type: | Bug → Cleanup/optimization |
Nick, thanks for this proposition. However I agree with Tim's comment, the improvement is not worth the breaking change.
comment:3 by , 5 years ago
| Description: | modified (diff) |
|---|---|
| Resolution: | wontfix |
| Status: | closed → new |
Reopening with a different approach based on my comment.
comment:4 by , 5 years ago
| Status: | new → assigned |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
Improving __repr__() sounds good to me.
comment:5 by , 5 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
PR