Opened 5 years ago
Closed 5 years ago
#30980 closed Cleanup/optimization (fixed)
admin.E130 (duplicate __name__ attributes of actions) should specify which were duplicated.
Reported by: | Keryn Knight | Owned by: | AdamDonna |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
The fact that the __name__
is used is somewhat an implementation detail, and there's no guarantee the user has enough of an understanding of python to know what that attribute is, let alone how to fix it.
This just came up on IRC because a user had defined actions = [delete_selected]
where delete_selected
was a reference to their own callable, but shares the name of the base one (and by specifying the actions =
they were assuming that they were wholesale replacing the actions list, where that may not be true for site-wide actions) so errored ... but they only had define a list of len(...) == 1
so how can there be a duplicate (is their thought process)?
The error message should specify those names that occur 2> (rather than just check len(...)
vs len(set(...))
), and ought ideally to explain where the duplicate comes from (ie: AdminSite-wide).
Related ticket about E130: #30311 (+ those it references) but is about the replacement strategy rather than the error message itself.
Change History (7)
comment:1 by , 5 years ago
Easy pickings: | set |
---|---|
Summary: | admin.E130 (duplicate __name__ attributes of actions) should specify which were duplicated → admin.E130 (duplicate __name__ attributes of actions) should specify which were duplicated. |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 5 years ago
Hey! I am new to django contribution and I want to solve this issue. I want to know that error message of duplicates should write after the error of unique name in the same function ?
comment:4 by , 5 years ago
Has patch: | set |
---|---|
Needs documentation: | set |
Patch needs improvement: | set |
comment:6 by , 5 years ago
Needs documentation: | unset |
---|---|
Owner: | changed from | to
Patch needs improvement: | unset |
Triage Stage: | Accepted → Ready for checkin |
Agreed, we can add names of duplicated actions to this message.