diff options
author | mkanat%bugzilla.org <> | 2009-09-26 23:33:11 +0000 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2009-09-26 23:33:11 +0000 |
commit | 77417e27494a15ded3625ee3cceae93438ccd331 (patch) | |
tree | c783cd63714fba5480a713c6e6c1a08481bb4a70 | |
parent | 9d90201cb887382a67b769958211b736f88e08b2 (diff) | |
download | bugs-77417e27494a15ded3625ee3cceae93438ccd331.tar bugs-77417e27494a15ded3625ee3cceae93438ccd331.tar.gz bugs-77417e27494a15ded3625ee3cceae93438ccd331.tar.bz2 bugs-77417e27494a15ded3625ee3cceae93438ccd331.tar.xz bugs-77417e27494a15ded3625ee3cceae93438ccd331.zip |
Bug 517793: Use the ENCODING parameter of Template Toolkit instead of having a custom parser object. This also fixes a memory leak on mod_perl.
Patch by Max Kanat-Alexander <mkanat@buzgilla.org> r=LpSolit, a=LpSolit
-rw-r--r-- | Bugzilla/Template.pm | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 05ce2dde5..d6f665952 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -45,7 +45,6 @@ use Bugzilla::User; use Bugzilla::Error; use Bugzilla::Status; use Bugzilla::Token; -use Bugzilla::Template::Parser; use Cwd qw(abs_path); use MIME::Base64; @@ -59,28 +58,6 @@ use Scalar::Util qw(blessed); use base qw(Template); -# As per the Template::Base documentation, the _init() method is being called -# by the new() constructor. We take advantage of this in order to plug our -# UTF-8-aware Parser object in neatly after the original _init() method has -# happened, in particular, after having set up the constants namespace. -# See bug 413121 for details. -sub _init { - my $self = shift; - my $config = $_[0]; - - $self->SUPER::_init(@_) || return undef; - - $self->{PARSER} = $config->{PARSER} - = new Bugzilla::Template::Parser($config); - - # Now we need to re-create the default Service object, making it aware - # of our Parser object. - $self->{SERVICE} = $config->{SERVICE} - = Template::Config->service($config); - - return $self; -} - # Convert the constants in the Bugzilla::Constants module into a hash we can # pass to the template object for reflection into its "constants" namespace # (which is like its "variables" namespace, but for constants). To do so, we @@ -480,6 +457,8 @@ sub create { # Initialize templates (f.e. by loading plugins like Hook). PRE_PROCESS => "global/initialize.none.tmpl", + ENCODING => Bugzilla->params->{'utf8'} ? 'UTF-8' : undef, + # Functions for processing text within templates in various ways. # IMPORTANT! When adding a filter here that does not override a # built-in filter, please also add a stub filter to t/004template.t. |