Closed Bug 731175 Opened 12 years ago Closed 12 years ago

Bugzilla::Field shouldn't assume that someone else already loaded required modules

Categories

(Bugzilla :: Bugzilla-General, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: LpSolit, Assigned: LpSolit)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch, v1 (obsolete) — Splinter Review
I realized that if I remove |use Bugzilla::Bug| from Template.pm (because this is only needed in get_bug_link(), i.e. when viewing bugs only, and we can avoid the load time penalty for other pages), Bugzilla::Field->legal_values crashes complaining that modules such as Bugzilla::Component aren't loaded. The reason is that currently, |use Bugzilla| called from CGI scripts loads Bugzilla::Template, which loads Bugzilla::Bug, which loads Bugzilla::Component & co. This is a very bad assumption and a weak dependency chain, and legal_values() should load these modules itself before calling get_all().

I also removed two other useless |use Bugzilla::Foo| from Template.pm.
Attachment #601245 - Flags: review?(glob)
Actually, there are several methods in Field.pm which have the same problem.
Summary: legal_values() shouldn't assume that someone else already loaded required modules → Bugzilla::Field shouldn't assume that someone else already loaded required modules
Attached patch patch, v1.1Splinter Review
Attachment #601245 - Attachment is obsolete: true
Attachment #601252 - Flags: review?(glob)
Attachment #601245 - Flags: review?(glob)
Comment on attachment 601252 [details] [diff] [review]
patch, v1.1

r=glob
Attachment #601252 - Flags: review?(glob) → review+
Flags: approval+
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/Template.pm
modified Bugzilla/Field/Choice.pm
Committed revision 8141.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Blocks: 732978
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: