]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 517793: Use the ENCODING parameter of Template Toolkit instead of having a custom...
authormkanat%bugzilla.org <>
Sat, 26 Sep 2009 23:37:22 +0000 (23:37 +0000)
committermkanat%bugzilla.org <>
Sat, 26 Sep 2009 23:37:22 +0000 (23:37 +0000)
Patch by Max Kanat-Alexander <mkanat@buzgilla.org> r=LpSolit, a=LpSolit

Bugzilla/Template.pm

index 89d94c0245dd83d1fe6a9efb28de8c6c778c80c5..62ec148c7299e0f6322bb506da22c9c593720107 100644 (file)
@@ -42,7 +42,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;
@@ -55,28 +54,6 @@ use IO::Dir;
 
 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
@@ -472,6 +449,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.