Subject: | missing template error report is inaccurate |
M-V-B generates a special error page to report missing templates. But the text is misleading because it doesn't allow for the possibility that the error might not be in the main template but in a sub-template (or even be a missing BLOCK in TT!). The attached patch improves the text, IMHO. It also updates the HTML to XHTML, I think.
Cheers, Dave
--- /root/.cpan/build/Maypole-2.10/lib/Maypole/View/Base.pm 2005-07-18 10:44:49.000000000 +0100
+++ Maypole/View/Base.pm 2005-08-12 10:50:32.000000000 +0100
@@ -90,23 +90,31 @@
# a static page
return -1 unless @{ $r->{objects} || [] };
+ my $template_error = $r->{error};
$r->{error} = <<EOF;
-<H1> Template not found </H1>
+<h1> Template not found </h1>
-This template was not found while processing the following request:
+A template was not found while processing the following request:
-<B>@{[$r->{action}]}</B> on table <B>@{[ $r->{table} ]}</B> with objects:
+<strong>@{[$r->{action}]}</strong> on table
+<strong>@{[ $r->{table} ]}</strong> with objects:
-<PRE>
+<pre>
@{[join "\n", @{$r->{objects}}]}
-</PRE>
+</pre>
-Looking for template <B>@{[$r->{template}]}</B> in paths:
-<PRE>
+The main template is <strong>@{[$r->{template}]}</strong>.
+The template subsystem's error message was
+<pre>
+$template_error
+</pre>
+We looked in paths:
+
+<pre>
@{[ join "\n", $self->paths($r) ]}
-</PRE>
+</pre>
EOF
$r->{content_type} = "text/html";
$r->{output} = $r->{error};