Opened 8 months ago

Closed 8 months ago

#23287 closed Cleanup/optimization (fixed)

Change exception message for django.utils.decorators.classonlymethod

Reported by: zsoldosp Owned by: timgraham
Component: Utilities Version:
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

The exception message when invoking it on an instance is (at the time of opening) is "This method is available only on the view class."

However, there isn't anything about this decorator that is CBV specific, and it is located in the generic django.utils module.

I propose to change the exception message to some variant of "This method is available only on the class, not on instances."

(It came up in a pull request discussion with @timgraham - https://github.com/django/django/pull/2674#discussion_r15948247)

Change History (2)

comment:1 Changed 8 months ago by timgraham

  • Component changed from Uncategorized to Utilities
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to timgraham
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 8 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 64bb122c3dede3538294bab07d5f1a1980713d31:

Fixed #23287 -- Updated error message for classonlymethod decorator.

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