Using I frame to contain the additional Comments section
Myk Melez
myk at mozilla.org
Fri May 2 18:37:54 UTC 2003
Casey Gregoire wrote:
>Can anyone tell me if there was a better way to go about doing this that
>would query the database only once? (I don't want to have to change the
>actual source code of Bugzilla if I can avoid it.)
>
Currently Bugzilla generally assumes that every template wants to
display everything it can, since templates were originally ported from
inline HTML in the Perl script, where only one format was ever
possible. Bugzilla thus pushes all the data at the template, which
decides what data to display.
Now that we have templates and multiple formats, we need to change that
model so that Bugzilla merely hands the template a reference to a bug
object, the template requests data from the bug object, and the bug
object gets data from the database on demand. The template then pulls
the data it wants when it wants it, and it doesn't pull any data it
doesn't want. You still incur the cost of instantiating the script a
second time in this model, but that cost will be effectively eliminated
when mod_perl/SpeedyCGI support gets implemented (work on this is ongoing).
Unfortunately not much work is happening on switching from push to pull
models, but fortunately some work has already been done, and one of the
pieces that was done was comments on the "show bug" page, so when you go
to the "show bug" page for a specific bug, show_bug.cgi hands the
template a bug object, and that bug object doesn't pull comments from
the database until the template calls its "longdesc" method.
Just make sure you aren't calling that method in the main template, and
you should be able to save the cost of pulling that data twice. You'll
still pull other data twice, because the bug object assumes you want a
base set of data that you probably don't need in the comments iframe.
Perhaps you'd be interested in taking on the task of fixing that by
converting it over to a pull model?
-myk
More information about the developers
mailing list