From 3cf2fea8686cea17e128789566a0cd55f2046833 Mon Sep 17 00:00:00 2001 From: Aaron Trevena Date: Mon, 12 Jun 2006 14:25:36 +0000 Subject: [PATCH] fixed error template in TT.pm and possible work around for ->object to work git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@493 48953598-375a-da11-a14b-00016c27c3ee --- lib/Maypole.pm | 2 -- lib/Maypole/View/Base.pm | 6 +++--- lib/Maypole/View/TT.pm | 28 ++++++++++++++++++---------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/lib/Maypole.pm b/lib/Maypole.pm index 5837848..770467a 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -955,8 +955,6 @@ sub send_output { } - - =back =head2 Path processing and manipulation diff --git a/lib/Maypole/View/Base.pm b/lib/Maypole/View/Base.pm index 1cc9b2b..5a99580 100644 --- a/lib/Maypole/View/Base.pm +++ b/lib/Maypole/View/Base.pm @@ -42,10 +42,10 @@ sub vars { objects => $r->objects, base => $base, config => $r->config, - object => $r->object, - - # ... ); + + $args{object} = $r->object if ($r->can('object')); + if ($class) { my $classmeta = $r->template_args->{classmetadata} ||= {}; $classmeta->{name} ||= $class; diff --git a/lib/Maypole/View/TT.pm b/lib/Maypole/View/TT.pm index a1484d5..78aad93 100644 --- a/lib/Maypole/View/TT.pm +++ b/lib/Maypole/View/TT.pm @@ -49,6 +49,9 @@ sub template { sub report_error { my ($self, $r, $error, $type) = @_; my $output; + + warn "self : $self, r : $r, error : $error, type : $type\n"; + # Need to be very careful here. my $tt = Template->new; unless (ref $r->{config}) { @@ -60,7 +63,8 @@ sub report_error { { err_type => $type, error => $error, config => $r->{config}, request => $r, - eval{$self->vars($r)} }, \$output )) { + paths => $self->paths($r), + eval{$self->vars($r)} }, \$output )) { $r->{output} = $output; if ($tt->error) { $r->{output} = "Even the error template errored - ".$tt->error.""; } @@ -399,23 +403,27 @@ the path "[% request.path %]". The error text returned was:

Request details

- +
[% FOR attribute = ["model_class", "table", "template", "path", "content_type", "document_encoding", "action", "args", "objects"] %] - [% END %]
[% attribute %] [% +
[% attribute %] [% request.$attribute.list.join(" , ") %]
+

Website / Template Paths

+ + + +
Base URI [% request.config.uri_base %]
Paths [% paths %]
+

Application configuration

- - [% FOR field IN config %] - - [% END %] +
[% field.key %] [% - $field.value.list.join(" , ") %]
+ + + +
Model [% request.config.model %]
View [% request.config.view %]
Classes [% request.config.classes.list.join(" , ") %]
Tables [% request.config.display_tables.list.join(" , ") %]
- - -- 2.39.5