diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt
index 413582c00..7ac5f2e2e 100644
--- a/docs/changelog/7.x.x.txt
+++ b/docs/changelog/7.x.x.txt
@@ -3,6 +3,7 @@
- fixed #11024: In/Out Board Busted
- fixed #11025: Yo dudely in Wiki Keyword Search Template
- fixed #11027: trash warning but no trash-limbo warning
+ - fixed #11031: AssetProxy refering to trash-limbo asset
7.8.0
- upgraded YUI to 2.8.0r4
diff --git a/lib/WebGUI/Asset/Template.pm b/lib/WebGUI/Asset/Template.pm
index 798ebf0bc..d9330cf0d 100644
--- a/lib/WebGUI/Asset/Template.pm
+++ b/lib/WebGUI/Asset/Template.pm
@@ -585,21 +585,32 @@ A hash reference containing template variables and loops. Automatically includes
=cut
-# TODO: Have this throw an error so we can catch it and print more information
-# about the template that has the error. Finding an "ERROR: Error in template"
-# in the error log is not very helpful...
sub process {
- my $self = shift;
- my $vars = shift;
+ my $self = shift;
+ my $vars = shift;
+ my $session = $self->session;
+
+ if ($self->get('state') =~ /^trash/) {
+ my $i18n = WebGUI::International->new($session, 'Asset_Template');
+ $session->errorHandler->warn('process called on template in trash: '.$self->getId
+ .'. The template was called through this url: '.$session->asset->get('url'));
+ return $session->var->isAdminOn ? $i18n->get('template in trash') : '';
+ }
+ elsif ($self->get('state') =~ /^clipboard/) {
+ my $i18n = WebGUI::International->new($session, 'Asset_Template');
+ $session->errorHandler->warn('process called on template in clipboard: '.$self->getId
+ .'. The template was called through this url: '.$session->asset->get('url'));
+ return $session->var->isAdminOn ? $i18n->get('template in clipboard') : '';
+ }
# Return a JSONinfied version of vars if JSON is the only requested content type.
- if ( defined $self->session->request && $self->session->request->headers_in->{Accept} eq 'application/json' ) {
- $self->session->http->setMimeType( 'application/json' );
+ if ( defined $session->request && $session->request->headers_in->{Accept} eq 'application/json' ) {
+ $session->http->setMimeType( 'application/json' );
return to_json( $vars );
}
$self->prepare unless ($self->{_prepared});
- my $parser = $self->getParser($self->session, $self->get("parser"));
+ my $parser = $self->getParser($session, $self->get("parser"));
my $template = $self->get('usePacked')
? $self->get('templatePacked')
: $self->get('template')
@@ -607,8 +618,8 @@ sub process {
my $output;
eval { $output = $parser->process($template, $vars); };
if (my $e = Exception::Class->caught) {
- $self->session->log->error(sprintf "Error processing template: %s, %s, %s", $self->getUrl, $self->getId, $e->error);
- my $i18n = WebGUI::International->new($self->session, 'Asset_Template');
+ $session->log->error(sprintf "Error processing template: %s, %s, %s", $self->getUrl, $self->getId, $e->error);
+ my $i18n = WebGUI::International->new($session, 'Asset_Template');
$output = sprintf $i18n->get('template error').$e->error, $self->getUrl, $self->getId;
}
return $output;
diff --git a/lib/WebGUI/i18n/English/Asset_Template.pm b/lib/WebGUI/i18n/English/Asset_Template.pm
index a431ee5da..5b4319033 100644
--- a/lib/WebGUI/i18n/English/Asset_Template.pm
+++ b/lib/WebGUI/i18n/English/Asset_Template.pm
@@ -369,6 +369,16 @@ Any scratch variables will be available in the template with this syntax:
lastUpdated => 0,
context => "Label for a JS file attachment that goes after all the content in the