added CGI params to TT error template
small improvements to some factory templates
fix to path handling in mod_perl and CGI when location ends in /
+ fixed template path ordering so i.e. /tablename/list is used before /list when provided with a tablename
2.11 Mon 31 July 2006
sub paths {
my ( $self, $r ) = @_;
+ warn "paths called with @_";
my $root = $r->config->template_root || $r->get_template_root;
if(ref($root) ne 'ARRAY') {
$root = [ $root ];
}
my @output = ();
foreach my $path (@$root) {
- push(@output, $path);
push(@output,
(
$r->model_class
&& File::Spec->catdir( $path, $r->model_class->table )
)
);
+ push(@output, $path);
push(@output, File::Spec->catdir( $path, "custom" ));
push(@output, File::Spec->catdir( $path, "factory" ));
}
- return @output;
+ return grep( $_, @output);
}
-
-
-
sub vars {
my ( $self, $r ) = @_;
my $class = $r->model_class;
use Template;
use File::Spec::Functions qw(catdir tmpdir);
-our $error_template;
+our $error_template;
{ local $/; $error_template = <DATA>; }
our $VERSION = '2.11';
return OK;
} else {
if ($@) {
- warn "fatal error in template '$template_file' : $@\n";
- $r->{error} = "fatal error in template '$template_file' : $@";
+ my $error = "fatal error in template '$template_file' : $@\nTT paths : " . join(', ',$self->paths($r)) . "\n";
+ $r->warn($error);
+ $r->{error} = $error;
} else {
- warn "TT error for template '$template_file'\n" . $self->{tt}->error;
- $r->{error} = "TT error for template '$template_file'\n" . $self->{tt}->error;
+ my $error = "TT error for template '$template_file'\n" . $self->{tt}->error . "\nTT paths : " . join(', ',$self->paths($r)) . "\n";
+ $r->warn($error);
+ $r->{error} = $error;
}
return ERROR;
}