[Catalyst-commits] r12980 - in
Catalyst-View-Mason/branches/no_request: . lib/Catalyst/View t
theory at dev.catalyst.perl.org
theory at dev.catalyst.perl.org
Tue Feb 23 18:56:15 GMT 2010
Author: theory
Date: 2010-02-23 18:56:15 +0000 (Tue, 23 Feb 2010)
New Revision: 12980
Modified:
Catalyst-View-Mason/branches/no_request/Changes
Catalyst-View-Mason/branches/no_request/lib/Catalyst/View/Mason.pm
Catalyst-View-Mason/branches/no_request/t/norequest.t
Log:
Add support for running render with a undef context.
This is in line with a change to View::TT 0.30.
Modified: Catalyst-View-Mason/branches/no_request/Changes
===================================================================
--- Catalyst-View-Mason/branches/no_request/Changes 2010-02-23 18:52:12 UTC (rev 12979)
+++ Catalyst-View-Mason/branches/no_request/Changes 2010-02-23 18:56:15 UTC (rev 12980)
@@ -3,7 +3,10 @@
0.19
- Change the (undocumented) `template` accessor to `interp`, since
it's a Mason interpreter object, not a template object. The
- `template` accessor is still available for backcompat.
+ `template` accessor is still available for backcompat.
+ - Added a test for direct rendering of a template from a view object,
+ without a request.
+ - Added support for running render with a undef context.
0.18 Sat, 22 Aug 2009 21:17:52 +0200
- Make it work with Catalyst::Runtime 5.80010.
Modified: Catalyst-View-Mason/branches/no_request/lib/Catalyst/View/Mason.pm
===================================================================
--- Catalyst-View-Mason/branches/no_request/lib/Catalyst/View/Mason.pm 2010-02-23 18:52:12 UTC (rev 12979)
+++ Catalyst-View-Mason/branches/no_request/lib/Catalyst/View/Mason.pm 2010-02-23 18:56:15 UTC (rev 12980)
@@ -203,11 +203,11 @@
sub _default_globals {
my ($self, $c) = @_;
- my %default_globals = (
+ my %default_globals = $c ? (
'$c' => $c,
'$base' => $c->request->base,
'$name' => $c->config->{name},
- );
+ ) : ();
return %default_globals;
}
@@ -219,7 +219,7 @@
$component_path = '/' . $component_path;
}
- $c->log->debug(qq/Rendering component "$component_path"/) if $c->debug;
+ $c->log->debug(qq/Rendering component "$component_path"/) if $c && $c->debug;
# Set the URL base, context and name of the app as global Mason vars
# $base, $c and $name
Modified: Catalyst-View-Mason/branches/no_request/t/norequest.t
===================================================================
--- Catalyst-View-Mason/branches/no_request/t/norequest.t 2010-02-23 18:52:12 UTC (rev 12979)
+++ Catalyst-View-Mason/branches/no_request/t/norequest.t 2010-02-23 18:56:15 UTC (rev 12980)
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More tests => 5;
use FindBin;
use lib "$FindBin::Bin/lib";
@@ -10,5 +10,5 @@
ok my $td = TestApp->view('Appconfig'), 'Get Appconfig view object';
isa_ok $td->interp, 'HTML::Mason::Interp', 'Object returned by interp()';
isa_ok $td->template, 'HTML::Mason::Interp', 'Object returned by template()';
-# is $td->render(undef, 'test', { message => 'hello' }), 'hello',
-# 'render() should return the template output';
+is $td->render(undef, 'test', { message => 'hello' }), 'hello',
+ 'render() should return the template output';
More information about the Catalyst-commits
mailing list