Opened 4 years ago

Last modified 4 years ago

#32572 closed Cleanup/optimization

ResolverMatch.__repr__() doesn't handle functools.partial() nicely. — at Version 3

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 Nick Pope)

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 (3)

comment:1 by Nick Pope, 4 years ago

Has patch: set

comment:2 by Mariusz Felisiak, 4 years ago

Resolution: wontfix
Status: assignedclosed
Type: BugCleanup/optimization

Nick, thanks for this proposition. However I agree with Tim's comment, the improvement is not worth the breaking change.

comment:3 by Nick Pope, 4 years ago

Description: modified (diff)
Resolution: wontfix
Status: closednew

Reopening with a different approach based on my comment.

Note: See TracTickets for help on using tickets.
Back to Top