Open Bug 365431 Opened 18 years ago Updated 12 years ago

Bugzilla::Object should have methods to create and update from the CGI

Categories

(Bugzilla :: Bugzilla-General, enhancement, P2)

2.23.3
enhancement

Tracking

()

People

(Reporter: mkanat, Unassigned)

Details

As shortcuts, Bugzilla::Object should have methods to create an object and update an object directly from the CGI object, so we don't have to write out or modify CGIs when we add a new field. (We would just have to modify the templates and the objects.)

The update one would probably be easiest, we could just call it update_from_cgi. It could take parameters to override whatever was passed in on the CGI.
Priority: -- → P2
Target Milestone: Bugzilla 3.2 → ---
I think we should stick with params (hashes) passed to create() and update(). We are doing code refactoring for this exact reason IMO.
The CGI methods would just be wrappers, for convenience.
Is that really useful? Because I cannot find any useful example.
Yeah, it would be incredibly useful. Bugzilla::Bug->create($cgi) instead of all of the code in post_bug.cgi.
(In reply to comment #4)
> Yeah, it would be incredibly useful. Bugzilla::Bug->create($cgi) instead of
> all of the code in post_bug.cgi.

This wouldn't be useful as CGI parameters depend on the naming chosen in the given HTML page. I still think this shouldn't be implemented.
The eventual goal here is total consistency across the codebase. We still have to update the code every time we change the HTML parameter names right now! This would get us one step closer, starting to centralize some of our CGI parameter names in the codebase inside of modules.
Assignee: mkanat → general
You need to log in before you can comment on or make changes to this bug.