Implement helper method to find module path of value
Finding the module path for where a given class or function is defined is functionality used in a few places across the Django codebase. Whilst in the majority of cases, f"{val.__module__}.{val.__qualname__}" is enough, there are some cases it's not.
As part of #35859, a few more cases of this pattern are being added to the codebase. I think we're now at the point where it makes sense to extract this out to a helper function somewhere in django.utils. The implementation in django.migrations.serializer.TypeSerializer seems to be the most robust, however will want some more thorough testing based on different input types.
Change History
(15)
| Component: |
Uncategorized → Utilities
|
| Easy pickings: |
unset
|
| Triage Stage: |
Unreviewed → Someday/Maybe
|
| Version: |
→ dev
|
| Owner: |
set to shrutisachan08
|
| Status: |
new → assigned
|
| Triage Stage: |
Someday/Maybe → Accepted
|
| Description: |
modified (diff)
|
| Owner: |
changed from shrutisachan08 to Vimal Sahani
|
| Patch needs improvement: |
set
|
| Patch needs improvement: |
unset
|
| Triage Stage: |
Accepted → Ready for checkin
|
| Needs tests: |
set
|
| Triage Stage: |
Ready for checkin → Accepted
|
| Needs tests: |
unset
|
| Triage Stage: |
Accepted → Ready for checkin
|
| Resolution: |
→ fixed
|
| Status: |
assigned → closed
|
Probably worth holding off on this ticket until #35859 is merged, so all uses can be covered.