Opened 2 years ago

Last modified 9 months ago

#32565 new Cleanup/optimization

Extract URL resolver view strings mapping to admindocs

Reported by: Adam Johnson Owned by: Alokik Roy
Component: Core (URLs) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

From discussion with Nick Pope: https://github.com/django/django/pull/14138#discussion_r595911054

URLResolver._is_callback() , URLResolver._callback_strs, and URLPattern.lookup_str all exist only to power django.contrib.admindocs functionality, and are all private attributes. The functionality they provide could be extracted into admindocs to avoid the overhead of storing extra strings per URL in projects not using admindocs (in my experience, that is most projects).

Change History (16)

comment:1 Changed 2 years ago by Carlton Gibson

Hmmm 🤔 — internally these are only used by admindocs. I wonder if they're not being used by tooling somewhere… (asked ref PyCharm for an initial data point.)

comment:2 Changed 2 years ago by Adam Johnson

I had the thought that, at the very least, we could make generation lazy.

comment:3 Changed 2 years ago by Carlton Gibson

Triage Stage: UnreviewedAccepted

Negative from PyCharm: they are not using these attributes. And if they’re not I’m inclined to punt on no-one really is.

comment:4 Changed 16 months ago by Alokik Roy

Hi everyone, I would like to work on this ticket and already have started the process too. But I had one doubt while I was trying to solve the issue, URLreslove._is_callback() functionality also gets used in tests too. I am new to contributions and wanted to know should I also work on fixing tests too or just admindocs.py file and resolve.py file only.

Last edited 16 months ago by Alokik Roy (previous) (diff)

comment:5 Changed 15 months ago by Alokik Roy

Owner: changed from nobody to Alokik Roy
Status: newassigned

comment:7 Changed 15 months ago by Alokik Roy

Has patch: set

comment:8 Changed 15 months ago by Mariusz Felisiak

Patch needs improvement: set

comment:9 Changed 14 months ago by Alokik Roy

Patch needs improvement: unset

Suggested Changes Implemented!

comment:10 Changed 14 months ago by Carlton Gibson

Needs documentation: set
Patch needs improvement: set

comment:11 Changed 14 months ago by Alokik Roy

Needs documentation: unset
Patch needs improvement: unset

Updated the patch and documented the changes.

comment:12 Changed 13 months ago by Carlton Gibson

Triage Stage: AcceptedReady for checkin

comment:13 Changed 13 months ago by Carlton Gibson <carlton@…>

Resolution: fixed
Status: assignedclosed

In 7f3cfaa1:

Fixed #32565 -- Moved internal URLResolver view-strings mapping to admindocs.

Moved the functionality of URLResolver._is_callback(),
URLResolver._callback_strs, URLPattern.lookup_str() to
django.contrib.admindocs.

comment:14 Changed 9 months ago by GitHub <noreply@…>

In 974942a7:

Fixed #33955, Fixed #33971 -- Reverted "Fixed #32565 -- Moved internal URLResolver view-strings mapping to admindocs."

This reverts commit 7f3cfaa12b28d15c0ca78bb692bfd6e59d17bff1.

Thanks Tom Carrick and Greg Kaleka for reports.

comment:15 Changed 9 months ago by Mariusz Felisiak <felisiak.mariusz@…>

In a108380:

[4.1.x] Fixed #33955, Fixed #33971 -- Reverted "Fixed #32565 -- Moved internal URLResolver view-strings mapping to admindocs."

This reverts commit 7f3cfaa12b28d15c0ca78bb692bfd6e59d17bff1.

Thanks Tom Carrick and Greg Kaleka for reports.
Backport of 974942a75039ba43e618f6a5ff95e08b5d5176fd from main

comment:16 Changed 9 months ago by Mariusz Felisiak

Has patch: unset
Resolution: fixed
Status: closednew
Triage Stage: Ready for checkinAccepted

Patch was reverted.

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