Closed Bug 622832 Opened 15 years ago Closed 15 years ago

Allow check_can_change_field to be called as a class method

Categories

(Bugzilla :: Creating/Changing Bugs, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 396600

People

(Reporter: gerv, Unassigned)

Details

We are using check_can_change_field to hide some fields on the enter bug page from those who can't edit them (and therefore can't submit them, and therefore have no need to see them). However, this requires a little hacking, because check_can_change_field is an object method, not a class method - i.e. it expects to be called on an existing Bug object. And when one is loading the form to file a bug, there is no such object. The information check_can_change_field gets from the bug object is: - Product ID - Whether there's an error or not - Under some circumstances, the assignee and QA contact - Whether the bug has ever been confirmed It would certainly be possible to change check_can_change_field so that it could be called as either an object method (whereupon it did checks using the data listed above) or as a class method (whereupon it didn't, because they make no sense in that context). This could be done, for example, by wrapping the calls to $self in a check which checked it was an instantiated object. Is that reasonable? Or are you going to tell me that I'm horribly abusing check_can_change_field and I need to write a near-duplicate visibility checking function for use when filing bugs? :-) Gerv
Essentially this wants to solve the same problem as bug 396600--that is, to use a method for both pages, very possibly the same method.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.