[Rt-commit] rt branch, new-style-templates, updated. rt-3.8.8-280-g3b4820b

Shawn Moore sartak at bestpractical.com
Thu Aug 5 17:30:08 EDT 2010


The branch, new-style-templates has been updated
       via  3b4820bb37223e5d78d5c1176e753e0bccb4073b (commit)
      from  aedb01387aab77eebfc301cfb264ddcd2eb2b743 (commit)

Summary of changes:
 lib/RT/Template_Overlay.pm |    3 ++-
 t/api/template-simple.t    |    8 +++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 3b4820bb37223e5d78d5c1176e753e0bccb4073b
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Aug 5 17:31:53 2010 -0400

    Make sure templates with missing } are correctly errors

diff --git a/lib/RT/Template_Overlay.pm b/lib/RT/Template_Overlay.pm
index 3ff2879..bf108bd 100755
--- a/lib/RT/Template_Overlay.pm
+++ b/lib/RT/Template_Overlay.pm
@@ -470,7 +470,8 @@ sub _ParseContentSimple {
         TYPE   => 'STRING',
         SOURCE => $args{Content},
     );
-    $template->compile;
+    my ($ok) = $template->compile;
+    return ( undef, $self->loc('Template parsing error') ) if !$ok;
 
     # copied from Text::Template::fill_in and refactored to be simple variable
     # interpolation
diff --git a/t/api/template-simple.t b/t/api/template-simple.t
index 7d885a3..e4efb58 100644
--- a/t/api/template-simple.t
+++ b/t/api/template-simple.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 use RT;
-use RT::Test tests => 186;
+use RT::Test tests => 196;
 
 my $queue = RT::Queue->new($RT::SystemUser);
 $queue->Load("General");
@@ -150,6 +150,12 @@ TemplateTest(
     SimpleOutput => "test { *!( }",
 );
 
+TemplateTest(
+    Content      => "\ntest { \$rtname ",
+    PerlOutput   => undef,
+    SimpleOutput => undef,
+);
+
 is($ticket->Status, 'new', "test setup");
 SimpleTemplateTest(
     Content => "\ntest { \$Ticket->Resolve }",

-----------------------------------------------------------------------


More information about the Rt-commit mailing list