Closed Bug 621659 Opened 14 years ago Closed 13 years ago

Add hook to tweak the params after reading from file

Categories

(Bugzilla :: Extensions, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: gerv, Unassigned)

Details

This is inspired by bug 473134, which wants a configurable attachment size limit by user class.

We should add a hook to the code which reads in the params, allowing you to modify the values dynamically. Of course, you wouldn't do so unconditionally - it would be easier just to change the param value. But you could have different values for different users. The above is just one case where that might be useful; others include letting some people resolve bugs with open blockers, or giving some people a different default query.

I anticipate this would be about five lines of code.

Gerv
mkanat: does this sound OK to you?

Gerv
  Ah, I'm not certain that it's the best idea. I think the case of a configurable attachment size limit by user class, for example, would be best dealt with by hooking the validators in Bugzilla::Attachment.
Max: you mean, replace the validator with a custom one (which optionally calls into the original one for some users) by monkeypatching the class? The validator does several things apart from checking the size, so that would require code copy and paste... Still, great to hear it's possible.

Gerv
(In reply to comment #3)
> Max: you mean, replace the validator with a custom one (which optionally calls
> into the original one for some users) by monkeypatching the class? The
> validator does several things apart from checking the size, so that would
> require code copy and paste... Still, great to hear it's possible.

  Actually you don't have to monkeypatch, there's an object_validators hook. But yeah, you would call the original one--I think there's already example code in the Example that does it.
(In reply to comment #3)
> that would require code copy and paste

  Also, maybe not--you could just do "local Bugzilla->params->{'some_value'} = 'blah'" before calling the original validator.
OK. Resolving this INCOMPLETE, in the sense that if we can come up with good use cases, it might be wanted, but at the moment there aren't any that people actually have given that the main one can be done another way.

Gerv
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.